-
Notifications
You must be signed in to change notification settings - Fork 450
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow
doSeq
in let x <- e | seq
fixes #1804
- Loading branch information
1 parent
9f2182f
commit 4bf89df
Showing
4 changed files
with
23 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
def inc : StateM Nat Nat := do | ||
let s ← get | ||
modify (· + 1) | ||
return s | ||
|
||
def f (x : Bool) : StateM Nat Nat := do | ||
let .true := x | return (← inc) | ||
get | ||
|
||
def g (x : Bool) : StateM Nat Nat := do | ||
let .true := x | do return (← inc) | ||
get | ||
|
||
#eval g true |>.run' 0 -- `0` as expected | ||
#eval f true |>.run' 0 -- should return `0`, not `1` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
0 | ||
0 |