-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly apply the import rename to ADTs
- Loading branch information
1 parent
71e2600
commit 7b518b7
Showing
4 changed files
with
8 additions
and
5 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
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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
type MyOption = (Some val) | (None) | ||
type MyOption(A): | ||
Some { val: A } | ||
None | ||
|
||
def MyOption/bind(val, nxt): | ||
def MyOption/bind(val: MyOption(A), nxt: (Id -> Id) -> A -> MyOption(B)) -> MyOption(B): | ||
match val: | ||
case MyOption/Some: | ||
nxt = undefer(nxt) | ||
return nxt(val.val) | ||
case MyOption/None: | ||
return MyOption/None | ||
|
||
def MyOption/wrap(val): | ||
def MyOption/wrap(val: A) -> MyOption(A): | ||
return MyOption/Some(val) |