Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module std;
- export Maybe;
- export Nothing;
- export Just;
- export force;
- export isNothing;
- Maybe<a> = variant Nothing, Just(a)
- force<a> :: Maybe<a> -> a;
- force(Just(x)) := x;
- force(Nothing) := error "forced a Nothing";
- isNothing<a> :: Maybe<a> -> Bool;
- isNothing(Just(_)) := false;
- isNothing(Nothing) := true;
Add Comment
Please, Sign In to add comment