Commit graph

242 commits

Author SHA1 Message Date
Leonardo de Moura
ef18b0ab49 chore: use [builtinInit] 2020-10-19 14:58:38 -07:00
Leonardo de Moura
e4b2614f5b chore: move to new frontend 2020-10-19 13:21:15 -07:00
Leonardo de Moura
d9daa68d54 chore: move to new frontend 2020-10-19 13:14:14 -07:00
Leonardo de Moura
97be6fa3a5 chore: move to new frontend 2020-10-19 12:43:00 -07:00
Leonardo de Moura
9995eb7ece chore: move to new frontend 2020-10-19 12:22:26 -07:00
Leonardo de Moura
c3897fff31 chore: move to new frontend 2020-10-19 12:15:48 -07:00
Leonardo de Moura
ab047cc4d1 chore: remove unnecessary file 2020-10-19 12:12:03 -07:00
Leonardo de Moura
a13569ab0f chore: move to new frontend 2020-10-19 12:04:50 -07:00
Leonardo de Moura
9778eca9b2 chore: move to new frontend 2020-10-19 11:50:42 -07:00
Leonardo de Moura
7f5ef0c30b chore: move to new frontend 2020-10-19 11:38:00 -07:00
Leonardo de Moura
e54a207986 refactor: provide Options to lean_eval_const
add `ImportM` monad for `addImportedFn`

cc @Kha
2020-10-19 10:21:38 -07:00
Leonardo de Moura
d3946e49f4 chore: move to new frontend 2020-10-19 06:13:11 -07:00
Leonardo de Moura
9abe45ae4f chore: move to new frontend 2020-10-19 06:03:09 -07:00
Leonardo de Moura
5402ea88a2 feat: add withNestedTraces 2020-10-18 16:31:01 -07:00
Leonardo de Moura
40ed0de071 chore: use traceCtx to indent traces in recursive applications 2020-10-18 11:13:59 -07:00
Leonardo de Moura
679187ae0a chore: move to new frontend 2020-10-18 09:11:16 -07:00
Leonardo de Moura
60091a49cd chore: move to new frontend 2020-10-18 08:38:17 -07:00
Leonardo de Moura
2d38e4d5bc chore: move to new frontend 2020-10-18 08:34:17 -07:00
Leonardo de Moura
a3429caaf4 chore: move to new frontend 2020-10-18 08:27:58 -07:00
Leonardo de Moura
f5a16bc8f0 fix: better support for constraints of the form ?m a =?= ?m b 2020-10-17 16:29:27 -07:00
Leonardo de Moura
1ce2cde099 chore: move to new frontend 2020-10-17 14:01:25 -07:00
Leonardo de Moura
a915822454 chore: cleanup 2020-10-17 13:49:14 -07:00
Leonardo de Moura
c354c3f8b1 chore: move to new frontend 2020-10-17 09:19:59 -07:00
Leonardo de Moura
deb9b570d5 chore: move to new frontend 2020-10-17 09:14:04 -07:00
Leonardo de Moura
319bbd4554 chore: move to new frontend 2020-10-17 09:09:56 -07:00
Leonardo de Moura
aeac85dadb chore: cleanup 2020-10-17 09:09:30 -07:00
Leonardo de Moura
0c1fda999e chore: cleanup 2020-10-17 09:00:05 -07:00
Leonardo de Moura
96d4c3d49b chore: move to new frontend 2020-10-17 08:54:40 -07:00
Leonardo de Moura
6c9f000885 chore: move to new frontend 2020-10-17 08:33:58 -07:00
Leonardo de Moura
2cc620a464 chore: move to new frontend 2020-10-17 08:31:20 -07:00
Leonardo de Moura
072906eb70 chore: move to new frontend 2020-10-17 08:18:33 -07:00
Leonardo de Moura
16646e2a93 chore: move to new frontend 2020-10-17 08:14:04 -07:00
Leonardo de Moura
728ff419c7 chore: move to new frontend 2020-10-17 08:10:20 -07:00
Leonardo de Moura
152f275aac chore: move to new frontend 2020-10-17 08:02:30 -07:00
Leonardo de Moura
f0bc72c2c1 chore: move to new frontend 2020-10-17 07:59:45 -07:00
Leonardo de Moura
4925bf22d4 chore: move to new frontend 2020-10-17 07:40:34 -07:00
Leonardo de Moura
0472f38dc8 chore: move to new frontend 2020-10-17 07:38:44 -07:00
Leonardo de Moura
9433124048 chore: move to new frontend 2020-10-17 07:35:58 -07:00
Leonardo de Moura
5ab15d4e60 chore: move to new frontend 2020-10-17 07:25:50 -07:00
Leonardo de Moura
ced9d88cc6 chore: move to new frontend 2020-10-17 07:24:10 -07:00
Leonardo de Moura
c75d0350ec chore: move to new frontend 2020-10-17 07:19:59 -07:00
Leonardo de Moura
eabee9ce7e chore: remove optParam at Eval.lean 2020-10-16 11:50:53 -07:00
Leonardo de Moura
6a7e997534 chore: improve error message 2020-10-15 10:44:16 -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
Leonardo de Moura
fa6b7b6393 feat: add MonadResolveName type class
`AttrM` can now resolve names.
2020-10-10 11:33:52 -07:00
Leonardo de Moura
82e11c401d fix: #eval was not capturing dbgTrace! output in pure code
In the following example, the output produced by `dbgTrace!` was not
being captured. It could break the lean server. At least, it broke the lean4-mode.
```lean
def f (x : Nat) : Nat :=
dbgTrace! ">>> " ++ toString x;
x + 1

eval f 10
```

cc @Kha
2020-10-05 10:22:04 -07:00
Leonardo de Moura
a3218dd063 refactor: export Core.mkFreshUserName to Lean namespace 2020-09-30 11:21:46 -07:00
Sebastian Ullrich
2d8c7e4fd0 fix: MetaM.run' 2020-09-29 07:59:22 -07:00
Leonardo de Moura
49c5c5c08a fix: horrible error message due to constApprox := true
The new test `typeMismatch.lean` contains two examples where the error
message was dreadful.
2020-09-29 07:54:48 -07:00
Leonardo de Moura
27be7e6812 fix: leaking isDefEqStuckExceptionId 2020-09-25 18:48:23 -07:00