Commit graph

20 commits

Author SHA1 Message Date
Leonardo de Moura
d2e5c1c300 feat: improve dbgTrace! macro 2020-10-13 12:38:04 -07:00
Leonardo de Moura
9538772c1c chore: do not use string interpolation by default at dbgTrace!
It is nice to be able to write `dbgTrace! x` instead of `dbgTrace! "{x}"`
2020-10-09 20:49:39 -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
ef27af9cf8 test: string interpolation 2020-10-09 17:02:12 -07:00
Leonardo de Moura
d9d8e95987 feat: elaborate doElems at doLetArrow
@Kha The Rust `let+return` example works in Lean too :)
The Rust function
```rust
fn f (x : i32) -> i32 {
    let y = if x == 0 { println!("x is zero"); return 100 } else { x + 1 };
    println!("y: {}", y)
    y
}
```
The Lean version is
```lean
def f (x : Nat) : IO Nat := do
let y ← if x == 0 then IO.println "x is zero"; return 100 else pure (x + 1)
IO.println ("y: " ++ toString y)
return y
```

The main missing feature now is the `try-catch-finally` `do` element.
2020-10-07 17:30:25 -07:00
Leonardo de Moura
ac07999e95 chore: cleanup do expander, and make sure it can handle the "easy" doLetArrows 2020-10-07 17:00:07 -07:00
Leonardo de Moura
5b76155318 feat: new return semantics
`return e` is not equivalent to `pure e` anymore.
Now, `return e` means "return value `e` as the result of the root `do` block".
2020-10-07 14:07:58 -07:00
Leonardo de Moura
e70dd03340 chore: remove forInMap 2020-10-07 10:01:04 -07:00
Leonardo de Moura
ac1c0714a1 fix: expand macros in patterns before retrieving pattern variables 2020-10-07 09:15:05 -07:00
Leonardo de Moura
294a750110 feat: expand doMatch 2020-10-06 19:07:47 -07:00
Leonardo de Moura
f4ccb78014 feat: improve tryPureCoe? and document its limitations 2020-10-06 17:41:45 -07:00
Leonardo de Moura
3a426d96e7 feat: custom error message header at elabTermEnsuringType
This commit also improves `ensureTypeOf!` primitive.
2020-10-06 09:27:13 -07:00
Leonardo de Moura
5f28f2badc test: add another do notation test 2020-10-05 19:19:18 -07:00
Leonardo de Moura
eac3ca9286 feat: let rec in do notation 2020-10-05 19:10:06 -07:00
Leonardo de Moura
43ce35985b chore: fix test 2020-10-05 16:47:34 -07:00
Leonardo de Moura
eafd9bc0ad feat: expand for x in xs notation 2020-10-05 15:37:34 -07:00
Leonardo de Moura
7a0cbdbe04 test: shadowing in do blocks 2020-10-05 11:51:17 -07:00
Leonardo de Moura
fb83e8e79b feat: allow any variable to be reassigned 2020-10-05 11:25:19 -07:00
Leonardo de Moura
c10e92b348 chore: add temporary workarounds 2020-09-30 07:05:46 -07:00
Leonardo de Moura
765a8ac984 test: do with optional ; 2020-09-28 17:10:57 -07:00