Commit graph

64 commits

Author SHA1 Message Date
Leonardo de Moura
2ebee8d00c fix: missing addJP 2020-12-08 12:09:52 -08:00
Leonardo de Moura
ae5aa51712 chore: add explicit discard 2020-12-08 06:18:18 -08:00
Sebastian Ullrich
2a5c85d9e3 refactor: inline FormatMacro
@leodemoura: This was just a remnant of the initial frontend porting, correct?
2020-11-28 12:37:36 +01:00
Leonardo de Moura
0869f38de4 chore: update structure, class, inductive 2020-11-27 15:09:30 -08:00
Leonardo de Moura
d6f778bec4 refactor: arbitrary without explicit arguments
@Kha I was tired of writing `arbitrary _` :)
There 0 places in the stdlib where the type needs to be provided.
If in the future we need to specify the type we can use
`arbitrary (α := <type>)`
2020-11-25 09:07:38 -08:00
Leonardo de Moura
f67c93191f feat: use |>. 2020-11-19 08:38:47 -08:00
Leonardo de Moura
c305c2691f chore: use := 2020-11-19 07:22:31 -08:00
Leonardo de Moura
ffc4abed32 fix: UInt* and USize Inhabited instances 2020-11-13 16:30:48 -08:00
Leonardo de Moura
f17e226638 chore: naming convention
Example: `mkNameStr` => `Name.mkStr`

cc @Kha
2020-11-11 10:08:55 -08:00
Leonardo de Moura
2d2d39c78e chore: use mut 2020-11-07 17:32:13 -08:00
Leonardo de Moura
81d6e065e7 chore: adjust files and tests 2020-11-07 17:32:12 -08:00
Leonardo de Moura
8c9f148e2f chore: use new termFor, termReturn, termTry, and tryUnless 2020-10-31 19:19:18 -07:00
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
43fbfec1fd chore: avoid Array.iterate and Array.iterateM 2020-10-22 16:30:04 -07:00
Leonardo de Moura
82ee2e361b chore: cleanup 2020-10-21 18:43:47 -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
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
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