Commit graph

107 commits

Author SHA1 Message Date
Wojciech Nawrocki
85dcdcde93 chore: use NonScalar 2021-07-24 10:45:28 +02:00
Wojciech Nawrocki
2e6382e1c7 feat: untyped references 2021-07-24 10:45:28 +02:00
Sebastian Ullrich
2091a09fa1 feat: IO.Process.Child.takeStdin 2021-06-11 17:53:51 -07:00
Daniel Selsam
a22bba7bbf feat: Process.exit
Closes #356
2021-06-11 17:53:51 -07:00
Sebastian Ullrich
1ebcf76d48 refactor: remove explicitly lifted IO functions and move more things into IO.FS
Automatic lifting takes care of this, and it wasn't consistently applied anyway
2021-06-11 17:53:51 -07:00
Wojciech Nawrocki
485f8ea2d0 feat: setup Emscripten file paths 2021-06-06 15:34:44 +02:00
Sebastian Ullrich
3fb7a2c0e1 fix: make problematic Ord -> LT instance a def 2021-05-31 19:05:50 -07:00
Sebastian Ullrich
6857076df4 feat: leanpkg build without external dependencies 2021-05-30 17:29:54 +02:00
Sebastian Ullrich
a9fa84815b feat: IO.createDir, IO.createDirAll 2021-05-30 17:29:54 +02:00
Sebastian Ullrich
94aea76922 feat: FilePath.metadata 2021-05-30 17:29:54 +02:00
Sebastian Ullrich
4354534fda feat: make FilePath a concrete type
Resolves #363
2021-05-28 14:19:59 +02:00
Sebastian Ullrich
2988897cac feat: IO.FS.readDir 2021-05-26 09:47:43 +02:00
Sebastian Ullrich
ed55fdfd3e chore: better error message when failing to find current package 2021-03-23 12:10:26 +01:00
Leonardo de Moura
1112ab6eff chore: use new notation 2021-03-11 11:19:33 -08:00
Leonardo de Moura
acfac85ac0 feat: add IO.getNumHeartbeats 2021-01-24 17:45:50 -08:00
Wojciech Nawrocki
a3f5aca22f fix: tail-recursive readBinToEnd 2021-01-22 18:02:31 +01:00
Wojciech Nawrocki
8addea6e74 chore: remove Handle.size 2021-01-22 18:02:31 +01:00
Sebastian Ullrich
0c91b3769e chore: replace variables in src/ 2021-01-22 14:36:05 +01:00
Sebastian Ullrich
e662992533 feat: IO.removeFile 2021-01-19 19:06:01 +01:00
Sebastian Ullrich
4a262fbc5b fix: remove auto-cancellation of IO tasks
Chained tasks were never auto-canceled, so let's be explicit everywhere
2020-12-30 17:03:09 +01:00
Sebastian Ullrich
4a22854b1e chore: make server tests fixable 2020-12-27 15:05:29 +01:00
Wojciech Nawrocki
3fca58ea8c feat: IO.FS.Handle.size 2020-12-23 20:00:36 +01:00
Marc Huisinga
088c3347cd feat: adjust file worker for new IO features 2020-12-23 20:00:36 +01:00
Leonardo de Moura
0869f38de4 chore: update structure, class, inductive 2020-11-27 15:09:30 -08:00
Leonardo de Moura
495b6a92e9 feat: add IO.sleep ms
I am going to use it in the documentation: `Task` examples.
2020-11-24 11:27:04 -08:00
Leonardo de Moura
be812081f4 chore: using "unbound implicit locals" 2020-11-23 13:09:02 -08:00
Leonardo de Moura
cb9574b086 chore: test unboundImplicitLocals and cleanup 2020-11-22 10:33:28 -08:00
Leonardo de Moura
90298ba476 feat: add helper instance 2020-11-19 11:32:54 -08:00
Leonardo de Moura
304c80d610 feat: use <| 2020-11-19 09:03:38 -08:00
Leonardo de Moura
c305c2691f chore: use := 2020-11-19 07:22:31 -08:00
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
Leonardo de Moura
bebca44773 feat: add println! macro for rewriting examples 2020-11-18 18:47:22 -08: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
5fed774461 chore: HasRepr ==> Repr 2020-10-27 16:15:10 -07:00
Leonardo de Moura
10c32fcf94 chore: HasToString => ToString 2020-10-27 16:11:48 -07:00
Leonardo de Moura
16f7bef88f chore: remove old frontend leftovers 2020-10-26 09:08:07 -07:00
Leonardo de Moura
13c2a8ff51 chore: remove #lang lean4 header 2020-10-25 09:54:07 -07:00
Leonardo de Moura
6514253d10 chore: move to new frontend 2020-10-23 16:56:36 -07:00
Sebastian Ullrich
890e84d351 feat: unsafeEIO 2020-10-23 18:34:47 +02:00
Leonardo de Moura
fa3c32d3b1 chore: remove adaptExcept 2020-10-22 16:56:23 -07:00
Leonardo de Moura
427936fa63 chore: move to new frontend 2020-10-22 07:02:40 -07:00
Sebastian Ullrich
8b62665788 chore: print dbg* output to stderr 2020-10-12 10:01:29 +02:00
Leonardo de Moura
82e11c401d fix: #eval was not capturing dbgTrace! output in pure code
In the following example, the output produced by `dbgTrace!` was not
being captured. It could break the lean server. At least, it broke the lean4-mode.
```lean
def f (x : Nat) : Nat :=
dbgTrace! ">>> " ++ toString x;
x + 1

eval f 10
```

cc @Kha
2020-10-05 10:22:04 -07:00
Sebastian Ullrich
16c71e6a26 fix: IO.Process.output 2020-09-29 08:01:10 -07:00
Sebastian Ullrich
562c7ed5ce feat: expose task priorities 2020-09-29 08:01:10 -07:00
Leonardo de Moura
0abca5475f refactor: move ppExpr to IO
@Kha I am also tracking `currNamespace` and `openDecls`.

BTW, I also tried an experiment where I added `currNamespace` and
`openDecls` to `Meta.Context`, but it looked weird. This information
is only needed in the elaborator and pretty printer.
The `PPContext` object should contain everything you need. You
can put `currNamespace` and `openDecls` in the `Delaborator.Context`.
2020-09-15 18:48:21 -07:00
Sebastian Ullrich
a93a53b4b5 feat: more IO Task functions 2020-09-14 17:57:33 +02:00
Sebastian Ullrich
77cbaa752c fix: Task: make reference and -j0 semantics eager, simplify 2020-09-14 17:57:33 +02:00
Sebastian Ullrich
5b83ceb1b5 feat: IO.mapTask, IO.bindTask 2020-09-14 17:57:33 +02:00