Commit graph

1397 commits

Author SHA1 Message Date
Leonardo de Moura
3757b26dc2 chore: move to new frontend 2020-10-23 17:30:48 -07:00
Leonardo de Moura
7dfff63db6 chore: move to new frontend 2020-10-23 17:15:05 -07:00
Leonardo de Moura
6514253d10 chore: move to new frontend 2020-10-23 16:56:36 -07:00
Leonardo de Moura
3651aa2159 chore: move to new frontend 2020-10-23 16:40:15 -07:00
Leonardo de Moura
8e9d2c434f chore: move to new frontend 2020-10-23 16:35:46 -07:00
Leonardo de Moura
e53874ce45 chore: move to new frontend 2020-10-23 16:32:44 -07:00
Leonardo de Moura
78c05e8f46 chore: move to new frontend 2020-10-23 16:13:55 -07:00
Leonardo de Moura
5c58d77836 chore: move to new frontend 2020-10-23 12:53:19 -07:00
Leonardo de Moura
7030dc91f2 chore: move to new frontend 2020-10-23 12:50:03 -07:00
Leonardo de Moura
30ce419e06 chore: move to new frontend 2020-10-23 12:14:34 -07:00
Leonardo de Moura
8bc90bc48d chore: move to new frontend 2020-10-23 11:19:50 -07:00
Leonardo de Moura
de66ca3943 feat: add helper functions for writing macros 2020-10-23 10:59:59 -07:00
Leonardo de Moura
e642c1047a chore: move to new frontend 2020-10-23 10:00:23 -07:00
Sebastian Ullrich
890e84d351 feat: unsafeEIO 2020-10-23 18:34:47 +02:00
Leonardo de Moura
0d99c92886 chore: use motive to name the motive of Eq.ndrec and friends 2020-10-23 05:34:26 -07:00
Leonardo de Moura
630dcf4cc1 chore: code convention 2020-10-22 18:34:43 -07:00
Leonardo de Moura
a0b8f13094 chore: remove temporary def 2020-10-22 17:42:25 -07:00
Leonardo de Moura
d4a67baa8e refactor: rename MonadFinally.finally' => MonadFinally.tryFinally' 2020-10-22 17:40:30 -07:00
Leonardo de Moura
f1dd85e8a3 chore: remove temporary defs 2020-10-22 17:31:07 -07:00
Leonardo de Moura
02521397ac refactor: rename MonadExceptOf.catch => MonadExceptOf.tryCatch 2020-10-22 17:27:15 -07:00
Leonardo de Moura
053b767336 chore: move to new frontend 2020-10-22 17:16:28 -07:00
Leonardo de Moura
a37e2ae46f refactor: simplify MonadFunctor 2020-10-22 17:05:34 -07:00
Leonardo de Moura
fa3c32d3b1 chore: remove adaptExcept 2020-10-22 16:56:23 -07:00
Leonardo de Moura
31fd054214 chore: remove adaptState and adaptReader 2020-10-22 16:32:58 -07:00
Leonardo de Moura
c865abb340 refactor: remove MonadRun 2020-10-22 16:30:06 -07:00
Leonardo de Moura
073bbeb676 chore: move to new frontend 2020-10-22 16:30:03 -07:00
Leonardo de Moura
19d7050847 chore: remove Lean.Name.Name.beq 2020-10-22 16:30:02 -07:00
Leonardo de Moura
311265d833 fix: Name.beq primitive name
@Kha I cannot change the name is one step. The problem is that stage0
contains only the function `l_Lean_Name_Name_beq___boxed`.
So, I have to add a function with the new name, update stage0, and
then delete the old one. Otherwise, the build breaks because
the interpreter will fail when we try to test whether two names are
equal or not. The summary is: we cannot change the Lean name for a
primitive in one step because it changes the name of the auxiliary
"boxed" definition used by the interpreter.
2020-10-22 16:30:02 -07:00
Leonardo de Moura
427936fa63 chore: move to new frontend 2020-10-22 07:02:40 -07:00
Sebastian Ullrich
b77a2de10d perf: must inline basic coercions 2020-10-22 14:26:51 +02:00
Leonardo de Moura
4f109e23c2 feat: return syntax object representing the whole file 2020-10-21 07:55:59 -07:00
Leonardo de Moura
fc9fb93c38 chore: adjust notation 2020-10-20 15:24:14 -07:00
Leonardo de Moura
fac2849e50 feat: forIn for PersistentArray 2020-10-20 09:33:50 -07:00
Leonardo de Moura
7bfa39ae45 fix: for .. in .. do notation and universe constraints
We use `MProd` instead of `Prod` to group values when expanding the
`do` notation. `MProd` is a universe monomorphic product.
The motivation is to generate simpler universe constraints in code
that was not written by the user but generated by the `do` macro.
Note that we are not really restricting the macro power since the
`HasBind.bind` combinator already forces values computed by monadic
actions to be in the same universe.

The new test cannot be compiled without this modication.
2020-10-18 18:05:00 -07:00
Leonardo de Moura
e3e89b4945 chore: add coercion for new frontend 2020-10-16 15:39:00 -07:00
Leonardo de Moura
dd4ae81774 chore: move to new frontend 2020-10-16 09:16:33 -07:00
Leonardo de Moura
e02a06ad1c chore: move to new frontend 2020-10-16 08:40:42 -07:00
Leonardo de Moura
54c1607b36 chore: export Name.eraseMacroScopes 2020-10-15 11:35:32 -07:00
Sebastian Ullrich
5a21725d69 perf: avoid String.toList 2020-10-15 19:43:13 +02:00
Leonardo de Moura
c1dccb8154 feat: stx[i] as notation for stx.getArg i 2020-10-13 15:48:39 -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
9204b4cc2f chore: missing specialize 2020-10-12 12:11:17 -07:00
Leonardo de Moura
eacdb5ff83 feat: add Range notation 2020-10-12 11:50:13 -07:00
Leonardo de Moura
f57201d787 feat: add Repr and HasToString instances for PUnit and ULift 2020-10-12 11:01:59 -07:00
Sebastian Ullrich
8b62665788 chore: print dbg* output to stderr 2020-10-12 10:01:29 +02:00
Leonardo de Moura
7c6b10012b chore: add helper function 2020-10-11 19:58:07 -07:00
Leonardo de Moura
8555cbaace fix: export command for new frontend 2020-10-11 19:44:43 -07:00
Leonardo de Moura
6a808540d5 chore: remove macro println! 2020-10-09 20:53:44 -07:00
Leonardo de Moura
bca81714fe feat: println! and dbgTrace! macros with string interpolation 2020-10-09 17:19:04 -07:00
Leonardo de Moura
51dc10dd93 feat: array slicing notation 2020-10-09 16:40:18 -07:00