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
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
749e2063cf
feat: add interpolated string for toString
2020-10-09 14:38:24 -07: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
550b5d2b47
chore: missing [inline]
2020-09-24 12:40:28 -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
Sebastian Ullrich
307a833798
feat: implement IO.asTask as primitive using always-run tasks
2020-09-14 17:57:33 +02:00
Sebastian Ullrich
c672bd657f
feat: IO.asTask
2020-09-14 17:57:33 +02:00
Sebastian Ullrich
e14e76775f
fix: ensure *println functions are atomic
2020-09-14 17:57:33 +02:00
Sebastian Ullrich
1fb1a6f913
fix: do not expose invalid process handles when not redirected
2020-08-30 14:28:56 -07:00
Sebastian Ullrich
9f40e46043
feat: basic process API
2020-08-30 14:28:56 -07:00
Sebastian Ullrich
95901a0346
fix: make Stream.ofBuffer thread-safe
2020-08-28 10:04:32 -07:00
Sebastian Ullrich
110ae4b571
feat: replace OS-specific stream redirection with pure-Lean Stream redirection
...
This avoids the temporary files workaround on macOS and Windows, and makes sure
we can process a `#eval` command and write messages to stdout at the same time.
2020-08-28 10:04:32 -07:00
Sebastian Ullrich
efa119bc94
feat: make std streams Streams
2020-08-28 10:04:32 -07:00
Sebastian Ullrich
1b0ffbb74d
feat: make std IO streams settable
...
Co-authored-by: Simon Hudon <simon.hudon@gmail.com>
2020-08-28 10:04:32 -07:00
Leonardo de Moura
321719b300
feat: add MonadFinally
2020-08-25 17:58:35 -07:00
Leonardo de Moura
1103806ff4
refactor: HasMonadLift ==> MonadLift
2020-08-25 13:54:41 -07:00
Leonardo de Moura
6180ba6d7d
chore: rename ST.Ref primitives
2020-08-23 12:28:14 -07:00
Leonardo de Moura
77b9445544
feat: real ST monad
...
@Kha: the new `ST` (and `EST`) are escapable like the Haskell ST monad.
It makes `StateRefT` much more useful because we can now run it from pure
code.
2020-08-23 12:15:32 -07:00
Leonardo de Moura
05a0e7f6d0
refactor: build all main monads on top of ECoreM
2020-08-20 18:36:04 -07:00
Leonardo de Moura
fad6235abb
feat: give a name to EIO Empty
...
@Kha I am calling it `ST` for lack of a better name. It makes some
sense since only the `IO.Ref` operations are in `EIO Empty` :)
That being said, it may confuse Haskell users.
BTW, I had to give the name to avoid a nontermination in the TC
procedure when using
```lean
instance EIOEmpty.monadLift {ε} : HasMonadLift (EIO Empty) (EIO ε) :=
{ monadLift := fun α => fromEmptyEIO }
```
2020-08-20 15:47:27 -07:00
Leonardo de Moura
eebc611391
chore: remove unnecessary workaround
2020-08-20 13:15:11 -07:00
Leonardo de Moura
968457ac1c
feat: make sure StateRefT can be used with any base EIO Exception
2020-08-20 13:11:12 -07:00
Leonardo de Moura
d36ccb166c
feat: use EIO Empty instead of IO at IO.Ref primitives
2020-08-20 12:54:15 -07:00
Leonardo de Moura
c55376a1ba
chore: more conventional MonadIO
2020-08-20 11:13:10 -07:00
Leonardo de Moura
4e736bcca0
feat: use trick to inform compiler that a builtin doesn't throw exceptions
2020-08-20 11:05:11 -07:00
Leonardo de Moura
c0dbf60830
feat: remove IO.ref.reset
...
`reset` was used to implement a "buggy" `IO.ref.modify`.
```lean
@[inline] def Ref.modify {α : Type} (r : Ref α) (f : α → α) : m Unit := do
v ← r.get;
r.reset;
r.set (f v)
```
`IO.Ref.reset` will store a nullptr in `r`.
Now, suppose another thread tries to read this reference,
it will get an `IO.error`.
It is not a crash, but it is really weird behavior.
2020-08-20 10:07:15 -07:00
Leonardo de Moura
b5ed59ef61
chore: missing [inline]
2020-08-19 17:10:52 -07:00
Leonardo de Moura
9158ba60ea
feat: add IO.toEIO
2020-08-19 09:43:26 -07:00
Leonardo de Moura
390aef535e
chore: remove workaround
2020-08-18 17:22:51 -07:00
Leonardo de Moura
e70ff5b773
refactor: simplify CoreM using StateRefT
2020-08-18 16:02:29 -07:00
Leonardo de Moura
b8044fdf97
chore: remove MonadExceptOf from MonadIO
...
@Kha we currently do not need this feature. We may add it back when needed.
2020-08-18 15:40:16 -07:00
Leonardo de Moura
aa2f834c0f
feat: add mkMonadIO and modifyGet
2020-08-18 13:25:15 -07:00
Leonardo de Moura
6c234daad7
chore: MonadExceptCore => MonadExceptOf
2020-08-13 09:28:23 -07:00
Wojciech Nawrocki
55655869b7
feat: default to binary file mode on Windows
2020-08-13 09:21:35 -07:00
Leonardo de Moura
d7add53229
feat: add MonadExceptCore
2020-08-13 09:19:26 -07:00
Sebastian Ullrich
b40ef65b39
feat: add IO.eprint(ln) for printing to stderr
...
Most useful when stdout is being consumed by another program
2020-07-06 09:22:47 -07:00
Sebastian Ullrich
6404af6983
feat: IO.Prim.withIsolatedStreams
2020-06-16 10:41:42 -07:00
Sebastian Ullrich
f4c28fbe5f
chore: remove unnecessary getByte/putByte IO primitives
2020-06-16 12:06:53 +02:00
Simon Hudon
a64e78b90b
feat: add std streams
...
Co-authored-by: Sebastian Ullrich <sebasti@nullri.ch>
2020-06-16 12:06:53 +02:00
Leonardo de Moura
05dda45a22
chore: remove { <structure-name> . ... } from stdlib
...
TODO: fix problems with `{ ... : <expected-type }` new syntax
2020-05-20 15:43:21 -07:00
Sebastian Ullrich
be79820a47
feat: add IO.currentDir
2020-05-14 14:38:52 +02:00