summaryrefslogtreecommitdiff
path: root/lib/ur/option.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-08-19 15:23:01 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2011-08-19 15:23:01 -0400
commit0156bf0da091dd2a773c08c2917c121bc86643bb (patch)
tree49a42ce8909e7f3df3a9fe122d4da57b21f67108 /lib/ur/option.ur
parent2babe3938c1d97e46be24e033d9cb575f746d80b (diff)
Basis.mkMonad
Diffstat (limited to 'lib/ur/option.ur')
-rw-r--r--lib/ur/option.ur6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/ur/option.ur b/lib/ur/option.ur
index 0aa07a2d..5c89fc9d 100644
--- a/lib/ur/option.ur
+++ b/lib/ur/option.ur
@@ -1,5 +1,11 @@
datatype t = datatype Basis.option
+val monad = mkMonad {Return = @@Some,
+ Bind = fn [a] [b] (m1 : t a) (m2 : a -> t b) =>
+ case m1 of
+ None => None
+ | Some v => m2 v}
+
fun eq [a] (_ : eq a) =
mkEq (fn x y =>
case (x, y) of