Commit graph

35 commits

Author SHA1 Message Date
Leonardo de Moura
43284cc5fa feat: improve notation for setting parser names and priorities 2020-12-21 09:11:12 -08:00
Leonardo de Moura
06ad52575a feat: force users to use discard when action result is not being bound and it is not PUnit
After this commit, we have to use an explicit `discard` in code such as
```
def g (x : Nat) : IO Nat := ...
def f (x : Nat) : IO Unit := do
  discard <| g x   -- type error without the `discard`
  IO.println x
```

Motivation: prevent users from making mistakes such as
```
def f (xs : Array Nat) : IO Unit := do
  xs.set! 0 1
  IO.println xs
```
when they meant to write
```
def f (xs : Array Nat) : IO Unit := do
  let xs := xs.set! 0 1
  IO.println xs
```
2020-12-08 06:14:48 -08:00
Leonardo de Moura
b6a1914299 chore: remove $. notation
It has been replaced by `|>.`
2020-11-19 08:47:35 -08:00
Leonardo de Moura
6c6595cd9b feat: only allow variables declared with mut to be reassigned 2020-11-07 17:32:13 -08:00
Leonardo de Moura
10c32fcf94 chore: HasToString => ToString 2020-10-27 16:11:48 -07:00
Leonardo de Moura
db9e390b4d chore: remove new_frontend from tests 2020-10-25 09:16:38 -07:00
Leonardo de Moura
f80345a6d4 chore: move tests to new frontend 2020-10-10 07:41:04 -07:00
Leonardo de Moura
6a808540d5 chore: remove macro println! 2020-10-09 20:53:44 -07:00
Leonardo de Moura
b4ef8de1a5 test: new frontend tests 2020-10-09 18:21:45 -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
7325dcd630 feat: use do at for-in and unless notations 2020-10-05 09:43:11 -07:00
Leonardo de Moura
d8c2d0b551 fix: CodeBlock concatenation 2020-10-04 17:59:56 -07:00
Leonardo de Moura
0caa17889f feat: remove old elabDo
Remark: we still have a few WIP
2020-10-04 17:14:36 -07:00
Leonardo de Moura
a0a724ddbd fix: tests and elabDo 2020-09-26 19:12:01 -07:00
Leonardo de Moura
ef9b661c8d chore: add temporary workarounds until we implement new elabDo 2020-09-26 18:11:46 -07:00
Leonardo de Moura
6892a957d6 feat: trailing ; in indented "do" sequences
cc @Kha
2020-09-26 16:08:30 -07:00
Leonardo de Moura
3f4499be08 feat: allow trailing ; at doSeqBracketed 2020-09-26 14:20:47 -07:00
Leonardo de Moura
5db5cf7734 fix: do not lift (<- action) nested in quotations 2020-09-11 08:06:20 -07:00
Leonardo de Moura
58c4d8bfc0 refactor: add MonadStateOf
@Kha I tried to remove `MonadExceptOf` by adding `HasThrow` and
`HasCatch`, but this change impacts our ability to define polymorphic
methods such as `finally` which is parametrized by `[MonadExcept]`.
If we remove the `outParam` from `[MonadExcept]`, then we will need to
know the exception at `finally`, or add two instances `[HasCatch]` and
`[HasThrow]`. So, it seems it is more convenient to have
`[MonadExceptOf]` and `[MonadExcept]`. Thus, I applied this approach
to `[MonadState]`
2020-08-18 16:35:33 -07:00
Leonardo de Moura
9519479726 chore: fix test 2020-08-18 15:19:22 -07: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
4250bc630e chore: fix tests 2020-06-08 16:18:46 -07:00
Leonardo de Moura
362185147e chore: remove unncessary annotation 2020-02-04 14:21:26 -08:00
Sebastian Ullrich
52a0a0937e feat: check precedence of leading parsers as well 2020-02-04 07:49:33 -08:00
Leonardo de Moura
31bb6a1dec feat: extend tryCoeAndLift
Add combined coe+lift case.
2020-02-03 14:30:13 -08:00
Leonardo de Moura
bcfaeaceab feat: change ite and dite argument order
Motivation: make sure `propagateExpectedType` heuristic is applied in
the new frontend when processing them.
2020-02-03 14:11:29 -08:00
Leonardo de Moura
a474850f5e feat: use automatic liftM at ensureHasType 2020-02-03 13:06:36 -08:00
Leonardo de Moura
48acc748ef feat: improve automatic liftM at do blocks
We now don't need to use `decide` in the following example:

```
def pred (x : Nat) : IO Bool := do
pure $ decide $ (← g 1) > 0
```
2020-02-03 12:16:57 -08:00
Leonardo de Moura
17cc925115 feat: change liftMethod notation
cc @Kha
2020-02-03 09:38:05 -08:00
Leonardo de Moura
8487216b1e feat: fallback to constApprox when foApprox fails 2020-02-01 22:50:29 -08:00
Leonardo de Moura
8de49b157c feat: add new approximation at isDefEq 2020-02-01 22:38:58 -08:00
Leonardo de Moura
a7c8978d81 feat: insert liftM automatically in do notation when needed
@Kha The new example demonstrates the feature in action.
I added a comment explaining why it is more effective than relying on coercions.
2020-02-01 17:33:04 -08:00
Leonardo de Moura
cd4ec6313e chore: try macros first 2020-02-01 00:53:49 -08:00
Leonardo de Moura
d8c738bef8 feat: elaborate do notation 2020-01-31 20:11:06 -08:00