Commit graph

70 commits

Author SHA1 Message Date
Leonardo de Moura
6858cb5fb6 chore: cleanup 2020-10-29 10:24:16 -07:00
Leonardo de Moura
6765440724 chore: remove clutter 2020-10-28 14:11:06 -07:00
Leonardo de Moura
898a08a0c1 chore: avoid Has prefix in type classes
closes #203
2020-10-27 18:29:19 -07:00
Leonardo de Moura
97c93ec557 chore: prepare to rename 2020-10-27 18:09:03 -07:00
Leonardo de Moura
ff493751b5 chore: HasFormat ==> ToFormat 2020-10-27 16:19:14 -07:00
Leonardo de Moura
10c32fcf94 chore: HasToString => ToString 2020-10-27 16:11:48 -07:00
Leonardo de Moura
13c2a8ff51 chore: remove #lang lean4 header 2020-10-25 09:54:07 -07:00
Leonardo de Moura
d89f559683 chore: fix definitions
See commit before update stage0 for explanation.
2020-10-24 07:27:25 -07:00
Leonardo de Moura
c7dc61adb9 chore: cleanup 2020-10-23 10:00:23 -07:00
Leonardo de Moura
43fbfec1fd chore: avoid Array.iterate and Array.iterateM 2020-10-22 16:30:04 -07:00
Sebastian Ullrich
4e74e36331 feat: run initializers on import
Also, refuse to evaluate an `[init]` decl in the same module (since we don't know whether the initialization is
backtrackable) and always use native symbol of a `[builtinInit]` decl
2020-10-22 11:59:55 +02:00
Sebastian Ullrich
4e8f4fcaef refactor: extract AttributeImplCore, introduce ParametricAttributeImpl 2020-10-22 11:59:55 +02:00
Leonardo de Moura
82ee2e361b chore: cleanup 2020-10-21 18:43:47 -07:00
Leonardo de Moura
29cb4e993b chore: export lean_is_io_unit_regular_init_fn and lean_is_io_unit_builtin_init_fn 2020-10-19 15:27:33 -07:00
Leonardo de Moura
1495f403a1 chore: use builtin_initialize instead of initialize at src/Lean 2020-10-19 15:17:02 -07:00
Leonardo de Moura
ef18b0ab49 chore: use [builtinInit] 2020-10-19 14:58:38 -07:00
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