Commit graph

5446 commits

Author SHA1 Message Date
Leonardo de Moura
e5b7daf9c2 refactor: make AppBuilder methods polymorphic 2020-08-24 18:23:34 -07:00
Leonardo de Moura
14f973d5a0 chore: fix tests 2020-08-24 17:59:11 -07:00
Leonardo de Moura
fab100abb4 chore: fix tests 2020-08-24 12:17:47 -07:00
Sebastian Ullrich
defc7f766e chore: try to fix benchmark once more... 2020-08-24 17:49:55 +02:00
Sebastian Ullrich
9106417693 chore: fix speedcenter test, perf stat runner not supporting multiline cmds 2020-08-24 16:30:50 +02:00
Sebastian Ullrich
015903f055 chore: speedcenter: benchmark actual, parallel stdlib build 2020-08-24 13:43:44 +02:00
Leonardo de Moura
060f7f0f04 chore: fix tests 2020-08-23 19:58:41 -07:00
Leonardo de Moura
77b9445544 feat: real ST monad
@Kha: the new `ST` (and `EST`) are escapable like the Haskell ST monad.
It makes `StateRefT` much more useful because we can now run it from pure
code.
2020-08-23 12:15:32 -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
5cc173788e chore: remove ECoreM 2020-08-21 17:29:13 -07:00
Leonardo de Moura
f46c5d01b1 feat: uniform Exceptions 2020-08-21 17:02:21 -07:00
Leonardo de Moura
32a55d5b9c refactor: remove special support for IO errors
They are now just regular errors.
2020-08-21 11:55:58 -07:00
Leonardo de Moura
916b395d1b chore: cleanup 2020-08-21 09:29:09 -07:00
Sebastian Ullrich
55b043cabe chore: update cross benchsuite 2020-08-21 16:05:40 +02:00
Sebastian Ullrich
786d90ac80 refactor: move parenthesizer and formatter into CoreM
/cc @leodemoura
2020-08-21 14:23:58 +02:00
Sebastian Ullrich
2a1d9b392f fix: test 2020-08-21 10:31:56 +02:00
Leonardo de Moura
d519a5d526 chore: use MetaM.toIO 2020-08-20 19:20:11 -07:00
Leonardo de Moura
cafb200296 chore: fix some tests 2020-08-20 19:13:47 -07:00
Leonardo de Moura
d6b96b4d8b chore: fix some tests 2020-08-20 18:36:29 -07:00
Leonardo de Moura
44f5182f76 chore: fix tests
We have removed `MetaIO`. We use use `CoreM` instead.
2020-08-20 15:56:29 -07:00
Sebastian Ullrich
ea266e48ab feat: unicodeSymbol.formatter: prefer symbol used in syntax tree 2020-08-20 18:57:08 +02:00
Sebastian Ullrich
2295749488 test: formatter no longer needs Lean.Parser imported 2020-08-20 15:55:41 +02:00
Leonardo de Moura
eec12232e3 chore: fix test
We would need to add the following instance to fix this example
```lean
instance ExceptT.monadIO {σ} (m : Type → Type) [Monad m] [MonadIO m] : MonadIO (ExceptT σ m) := {}
```
However, this instance may create problems for polymorphic functions on
`MonadIO m`. If `m` is of the form  `ExcepT Except1 ... EIO Exception2`,
then `finally` and `catch` is catching `Except1`. This is particularly
bad for code that uses `finally`.

Right now, we are not using monad stacks with multiple `ExceptT`s for
performance reasons, but we should have a solution for users.
2020-08-19 14:55:56 -07:00
Leonardo de Moura
75e6b5b379 fix: missing instance 2020-08-19 12:28:22 -07:00
Leonardo de Moura
61d1846334 feat: add adaptTheReader 2020-08-19 10:23:11 -07:00
Leonardo de Moura
e28f68936d feat: add MonadReaderOf 2020-08-19 10:14:36 -07:00
Sebastian Ullrich
eb5a171764 feat: adjust semantics to new syntax 2020-08-19 09:56:23 -07:00
Leonardo de Moura
58c4d8bfc0 refactor: add MonadStateOf
@Kha I tried to remove `MonadExceptOf` by adding `HasThrow` and
`HasCatch`, but this change impacts our ability to define polymorphic
methods such as `finally` which is parametrized by `[MonadExcept]`.
If we remove the `outParam` from `[MonadExcept]`, then we will need to
know the exception at `finally`, or add two instances `[HasCatch]` and
`[HasThrow]`. So, it seems it is more convenient to have
`[MonadExceptOf]` and `[MonadExcept]`. Thus, I applied this approach
to `[MonadState]`
2020-08-18 16:35:33 -07:00
Leonardo de Moura
9519479726 chore: fix test 2020-08-18 15:19:22 -07:00
Leonardo de Moura
647b917b49 test: HasGetAt helper class example 2020-08-18 15:16:02 -07:00
Leonardo de Moura
5605735137 feat: remove outparam from MonadState
We add helper classes with `outParam`.

@Kha This is similar to the `MonadExceptOf` modification.
Motivation: the new `StateRefT` (state monad implemented using
`IO.Ref`) makes is it quite cheap to have multiple states on the
stack. But, we need a mechanism for accessing the different states in
a convenient way.
Note that, I did not add a `MonadStateOf` class, but helper classes
such as `HasGet` which uses `outParam`. I will do the same for `MonadExcept`.

Summary:
- `get` gets the state on the top of the Monad stack
- `getThe σ` gets the state with type `σ`
- `modify f` modifies the state on the top of the Monad stack.
   We use `modify fun s => { s with ... }` quite often, and we cannot
   infer type of `s` here.
- `modifyThe σ f` allows us to select which state on the stack we are modifying.
- I didn't add `setThe`, since we usually can infer the state type at
  `set s`. In the whole codebase, we have only one instance where this
  is not true.
2020-08-18 15:15:31 -07:00
Leonardo de Moura
f01d45a6c1 feat: add StateRef 2020-08-18 13:54:51 -07:00
Leonardo de Moura
b142c608fe feat: add CoreM 2020-08-18 09:45:16 -07:00
Sebastian Ullrich
5e48d2bb7d chore: update cross benches 2020-08-18 11:44:29 +02:00
Leonardo de Moura
d059d28c22 fix: anonymous constructor elaborator 2020-08-17 17:32:11 -07:00
Leonardo de Moura
0cda65057e fix: addCtorFields 2020-08-17 17:25:42 -07:00
Leonardo de Moura
f7f77241a1 chore: fix test 2020-08-17 17:14:28 -07:00
Leonardo de Moura
81a19c8554 feat: structure instances with .. in patterns 2020-08-17 16:23:49 -07:00
Leonardo de Moura
9b085b97c4 feat: let+equations macro 2020-08-17 10:15:43 -07:00
Leonardo de Moura
f335cb3304 test: let+pattern 2020-08-17 09:28:25 -07:00
Leonardo de Moura
3342ba08d2 feat: implement let elaborators without using match_syntax
@Kha I had to do this because of the `ident` vs `Term.id` recurrent
issue. `match_syntax` fails if a `Term.id` is used at `Term.letIdDecl`
where an `ident` is expected.
We should try to remove `Term.id` in the future.
2020-08-17 09:27:54 -07:00
Leonardo de Moura
5d945dba2d test: match-expression 2020-08-16 15:50:22 -07:00
Leonardo de Moura
a97f8cb8e4 fix: nontermination at DepElim 2020-08-16 11:07:44 -07:00
Leonardo de Moura
58f4b280ca feat: elaborate nomatch 2020-08-16 08:26:04 -07:00
Leonardo de Moura
b616e8d07a test: do issue
This is the example triggered a panic message in the new frontend when
we were encoding `do a; b` as `a *> b`.
See 7cdf917c9
2020-08-15 16:07:01 -07:00
Leonardo de Moura
4f145c744e test: match-expr 2020-08-15 16:03:31 -07:00
Leonardo de Moura
e32ebc62c0 fix: tryPostponeIfMVar
Must not postpone if there is a term `t` (which is not a metavariable)
assigned to the metavariable `e.getAppFn`.
2020-08-15 14:36:16 -07:00
Leonardo de Moura
2295c315aa feat: add elabTermEnsuringType
This commit also fixes a match-expression error location issue.
2020-08-15 13:49:10 -07:00
Leonardo de Moura
e9748dd0f9 test: match equality proofs 2020-08-15 13:35:16 -07:00
Leonardo de Moura
bb261c51a6 fix: isDefEqQuick 2020-08-15 13:24:43 -07:00