lean4-htt/src/Init
Leonardo de Moura 91dca53274 refactor: remove MonadIO
There is no reason for having `MonadIO` anymore. The `MonadLift` type
class is well behaved in the new frontend, the `MonadFinally` solves
the problem at monad stacks such as `ExcepT e IO`.

This commit also changes the type of the IO printing functions.
For example, the type of `IO.println` was
```
def IO.println {m} [MonadIO m] {α} [ToString α] (s : α) : m Unit
```
and now it is just
```
def IO.println {α} [ToString α] (s : α) : IO Unit
```
We rely on the new frontend auto-lifting feature.
That is, if there is an instance `[MonadLiftT IO m]`, then
a term of type `IO a` is automatically coerced to `m a`

We also want a simpler `IO.println` for writing tests.
For example,
```
```
doesn't work because there isn't sufficient information for inferring
the parameter `m` in the previous `IO.println`.
The shortest workaround looked very weird
```
```

I considered adding `IO` as a default value for `m` when we have
`MonadIO m`, as we use `Nat` as the default for `ofNat a`, but it felt
like uncessary complexity.

@Kha The commit seems to work well. The auto-lifting featuring has
been working great for me. There is still room for improvement.
For example, given `MonadLiftT m n`, it doesn't automatically lift
`a -> m b` into `a -> n b`. So, code such as
`foo >>= IO.println`
had to be rewritten as
`foo >>= fun x => IO.println x`
I will add this feature later.
If you have time, please try to play with this feature and figure out
if it is stable enough for making it the default.
That is, if it roboust enough, we can stop using the following idiom
for writing functions that can be lifted automatically.
```
def instantiateLevelMVarsImp (u : Level) : MetaM Level :=
  ...

def instantiateLevelMVars {m} [MonadLiftT MetaM m] (u : Level) : m Level :=
  liftMetaM $ instantiateLevelMVarsImp u
```
I think we only need this idiom when using `MonadControlT` which is
not as common as `MonadLiftT`.
2020-11-18 18:47:22 -08:00
..
Control refactor: remove MonadIO 2020-11-18 18:47:22 -08:00
Data refactor: use Lists for Array reference implementation 2020-11-17 17:05:53 -08:00
System refactor: remove MonadIO 2020-11-18 18:47:22 -08:00
Classical.lean chore: cleanup 2020-11-10 15:40:00 -08:00
Coe.lean feat: add notation for coe 2020-11-11 16:39:01 -08:00
Control.lean chore: merge src/Control files 2020-11-10 18:47:23 -08:00
Core.lean refactor: move idDelta to Prelude.lean, add idRhs 2020-11-15 12:54:29 -08:00
Data.lean refactor: rename LeanInit ==> Meta, and reduce dependencies 2020-11-13 16:00:31 -08:00
Fix.lean fix: UInt* and USize Inhabited instances 2020-11-13 16:30:48 -08:00
Meta.lean chore: add expandInterpolatedStr helper function, rename msg! => m! 2020-11-14 13:52:52 -08:00
Notation.lean chore: cleanup parsers 2020-11-17 14:29:32 -08:00
NotationExtra.lean feat: define tactic parsers using syntax command 2020-11-17 13:52:36 -08:00
Prelude.lean refactor: use Lists for Array reference implementation 2020-11-17 17:05:53 -08:00
SizeOf.lean chore: move SizeOf to its own file 2020-11-10 14:43:03 -08:00
System.lean chore: remove #lang lean4 header 2020-10-25 09:54:07 -07:00
Util.lean feat: add Prelude.lean 2020-11-10 18:08:18 -08:00
WF.lean chore: move SizeOf to its own file 2020-11-10 14:43:03 -08:00