Commit graph

54 commits

Author SHA1 Message Date
Leonardo de Moura
84a0cd1f59 feat: add [builtinInit] attribute 2020-10-19 14:51:23 -07:00
Leonardo de Moura
a915822454 chore: cleanup 2020-10-17 13:49:14 -07:00
Leonardo de Moura
d2803d13d3 chore: move to new frontend 2020-10-17 07:10:05 -07:00
Leonardo de Moura
35e6c7a460 chore: move to new frontend 2020-10-17 06:55:28 -07:00
Leonardo de Moura
3ac2808481 chore: move to new frontend 2020-10-17 06:49:54 -07:00
Leonardo de Moura
880cbbb6dc chore: cleanup 2020-10-17 06:44:22 -07:00
Leonardo de Moura
2ee485fa5a chore: cleanup 2020-10-17 06:35:28 -07:00
Leonardo de Moura
e38989f937 chore: cleanup 2020-10-17 06:30:17 -07:00
Leonardo de Moura
1784f04403 chore: cleanup 2020-10-17 06:25:31 -07:00
Leonardo de Moura
933f5f9ca6 chore: use mutual recursion 2020-10-17 06:20:26 -07:00
Leonardo de Moura
133875447d chore: move to new frontend 2020-10-17 06:15:59 -07:00
Leonardo de Moura
bc7d86dfb7 chore: cleanup 2020-10-16 17:56:06 -07:00
Leonardo de Moura
34892d18fa chore: move to new frontend 2020-10-16 17:51:39 -07:00
Leonardo de Moura
b20d0fd31e chore: move to new frontend 2020-10-16 17:38:37 -07:00
Leonardo de Moura
d60b0ff3eb chore: move to new frontend 2020-10-16 17:33:08 -07:00
Leonardo de Moura
a936fba542 chore: cleanup 2020-10-16 17:25:44 -07:00
Leonardo de Moura
7dd27e843a chore: move to new frontend 2020-10-16 17:22:51 -07:00
Leonardo de Moura
9bbcea6e81 chore: move to new frontend 2020-10-16 17:08:20 -07:00
Leonardo de Moura
5c92cf3372 chore: cleanup 2020-10-16 17:07:46 -07:00
Leonardo de Moura
a3e803df49 chore: move to new frontend 2020-10-16 16:57:58 -07:00
Leonardo de Moura
842931cb1e chore: move to new frontend 2020-10-16 16:37:56 -07:00
Leonardo de Moura
26da4e6117 chore: move to new frontend 2020-10-16 16:32:04 -07:00
Leonardo de Moura
73184bfe16 chore: move to new frontend 2020-10-16 16:30:55 -07:00
Leonardo de Moura
21250aa108 chore: move to new frontend 2020-10-16 16:29:38 -07:00
Leonardo de Moura
d07a08c74c chore: move to new fronted 2020-10-16 16:28:25 -07:00
Leonardo de Moura
6625ff62c0 chore: move to new frontend 2020-10-16 16:27:04 -07:00
Leonardo de Moura
863cffde34 feat: elaborated borrowed annotations 2020-10-16 15:17:58 -07:00
Leonardo de Moura
eb187c97fe chore: move to new frontend 2020-10-16 12:50:57 -07:00
Leonardo de Moura
caac09b33e fix: forgot to reset params on block following joinpoint declaration 2020-10-14 07:41:35 -07:00
Leonardo de Moura
9af0a0e18b feat: add withReader method
@Kha `withReader` is a well-behaved version of `adaptReader`. `adaptReader` is
too general, and it often produces counterintuitive elaboration
errors.

Here are two super annoying issues I hit all the time:
1- `adaptReader` + polymorphic code
```
def ex1 : ReaderT Nat IO Unit :=
adaptReader (fun x => x + 1) $
  IO.println "foo" -- 3 Errors here failed to synthesize `Monad ?m` and  `MonadIO ?m`, and don't know how to synthesize `Type → Type`
```

2- `adaptReader` and notation that requires the expected type
```
structure Context :=
(x y : Nat)

def ex2 : ReaderT Context IO Nat :=
adaptReader (fun s => { s with x := 10 }) $ -- Error at the structure instance
  ...
```
In the example above, I have to write `fun (s : Context) => ...` to
fix the problem.

The two problems above happen in the old and new frontends. However,
there is a new problem specific for the new frontend. In the new
frontend, a `do` is only elaborated when the expected type is known.
So, `adaptReader (fun ctx => ...) do ...` seldom works :(

As I said above, the issue is that `adaptReader` is too general. Its
type is
```
  {ρ ρ' : Type u_1} → {m m' : Type u_1 → Type u_2} → [MonadReaderAdapter ρ ρ' m m'] → {α : Type u_1} → (ρ' → ρ) → m α → m' α
```

`withReader` is a simpler version of `adaptReader`
```
withReader : {ρ : Type u_1} → {m : Type u_1 → Type u_2} → [MonadWithReader ρ m] → {α : Type u_1} → (ρ → ρ) → m α → m α
```
It doesn't have any of the problems above. Moreover, I managed to replace
every single instance of `adaptReader` with `withReader` at the stdlib
and tests. We don't need the `adaptReader` generality.
2020-10-13 15:00:17 -07:00
Sebastian Ullrich
f9f723566f chore: emit initializers as static 2020-10-13 05:54:44 -07:00
Leonardo de Moura
07254fc71b fix: checkIsDefinition
For '[inline] partial' definitions in mutual blocks.
2020-10-12 15:57:39 -07:00
Leonardo de Moura
f84fa47566 fix: use resolveGlobalConstNoOverload at implementedBy attribute handler 2020-10-10 11:40:32 -07:00
Leonardo de Moura
89eebc9534 fix: use resolveGlobalConstNoOverload at init attribute handler 2020-10-10 11:37:37 -07:00
Leonardo de Moura
049ff2b022 fix: bad message 2020-09-25 18:48:23 -07:00
Leonardo de Moura
aa6d6c4dda feat: expose mkModuleInitializationFunctionName
cc @Kha

for https://github.com/leanprover/lean4/issues/185
2020-09-21 08:53:29 -07:00
Leonardo de Moura
a28679358e refactor: remove MonadError 2020-09-18 09:58:13 -07:00
Leonardo de Moura
b025c1c623 chore: remove HasEmptyc workarounds 2020-09-11 14:28:42 -07:00
Leonardo de Moura
20c041b421 feat: mkUnsafeRecName and isUnsafeRecName? in Lean 2020-09-05 08:03:52 -07:00
Leonardo de Moura
217b7fc2b8 feat: improve extern arity calculation 2020-08-31 16:29:27 -07:00
Leonardo de Moura
25384142c2 feat: add addPartialDecls
Helper method for implementing the idiom: unsafe decls + constant with `[implementedBy]`
2020-08-31 14:23:54 -07:00
Leonardo de Moura
1dcffe5714 feat: add setImplementedBy 2020-08-31 14:23:54 -07:00
Sebastian Ullrich
c88784ef9d refactor: consistent io_result_mk* naming
/cc @leodemoura
2020-08-31 11:08:57 +02:00
Leonardo de Moura
467e912380 fix: bug on JP handling 2020-08-26 08:34:35 -07:00
Leonardo de Moura
5ffbada3df feat: add Lean.MonadEnv, Lean.MonadError, and Lean.MonadOptions
This is the first set of polymorphic methods. I will add more later,
and keep reducing code duplication.

cc @Kha
2020-08-22 16:00:43 -07:00
Leonardo de Moura
68a4c145f7 refactor: implement attribute hooks using CoreM
We were using a mix of `IO` and `Except`
2020-08-19 14:44:54 -07:00
Leonardo de Moura
c8ab63ea75 feat: mark auxiliary eliminators as [inline] 2020-08-10 09:41:55 -07:00
Leonardo de Moura
cbb14673ef chore: move RBTree and RBMap to Std 2020-06-25 13:26:16 -07:00
Leonardo de Moura
11ed7c6195 chore: move PersistentArray to Std 2020-06-25 13:02:21 -07:00
Leonardo de Moura
02aa8498cd chore: move AssocList to Std 2020-06-25 12:52:23 -07:00