Lean 4 fork for HoTT-compatible kernel extensions (Path types, transport, HITs). Maintained against upstream leanprover/lean4.
Find a file
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
.github chore: go back to previous bootstrapping scheme where the stage N+1 stdlib is created using the stage N compiler 2020-09-24 18:57:53 +02:00
doc chore: go back to previous bootstrapping scheme where the stage N+1 stdlib is created using the stage N compiler 2020-09-24 18:57:53 +02:00
images
lean4-mode chore: add initialize to list of keywords 2020-10-10 06:45:28 -07:00
nix chore: update nixpkgs, changing back to LLVM 10 2020-07-08 12:14:49 +02:00
script chore: update CI 2020-06-10 21:30:38 +02:00
src feat: add withReader method 2020-10-13 15:00:17 -07:00
stage0 chore: update stage0 2020-10-13 12:53:46 -07:00
tests feat: add withReader method 2020-10-13 15:00:17 -07:00
tmp feat: add caseValues tactic 2020-08-06 15:37:00 -07:00
.clang-format feat(library/vm/process): add basic process support 2017-03-28 18:08:06 -07:00
.codecov.yml fix(.codecov.yml): do not fail github ci if coverage drops by 0.01% 2017-06-25 10:35:02 +02:00
.gitattributes chore: restore marking stage0/ as binary files, which we lost at some point 2020-08-14 11:12:13 +02:00
.gitignore chore: move bin/ and .oleans into build directory 2020-05-14 14:47:54 +02:00
CMakeLists.txt chore: use standard release build for stage 0 2020-10-12 10:34:48 +02:00
default.nix chore: add separate "Linux release" CI job using Nix channel with older glibc for compatibility 2020-06-10 21:30:38 +02:00
LICENSE
README.md chore(README): update 2019-04-24 11:40:46 -07:00
shell.nix chore: update temci 2020-07-21 18:30:22 +02:00

We are currently developing Lean 4. Lean 3 is still the latest official release. This repository contains work in progress.

Important. Unless you are one of our collaborators

  • We strongly suggest you use Lean 3.
  • Pull requests are not welcome.
  • New issues are not welcome, and will be closed without any feedback.