summaryrefslogtreecommitdiff
path: root/lib/ur/option.ur
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@mit.edu>2020-05-31 18:29:03 -0400
committerGravatar Benjamin Barenblat <bbaren@mit.edu>2020-05-31 18:29:03 -0400
commit6cc104634ef64be3be88c1fccbe98208d95d8a1a (patch)
tree9001e5333e808808125978a52669a8bff3639438 /lib/ur/option.ur
parent82fde07cef0e41b700b9a30137562eb05f2f2c6d (diff)
parentc2f1e1096f602b1cbd4531352f3e1ea6d656a186 (diff)
Merge branch 'dfsg_clean'
Diffstat (limited to 'lib/ur/option.ur')
-rw-r--r--lib/ur/option.ur5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/ur/option.ur b/lib/ur/option.ur
index baa08466..dd186161 100644
--- a/lib/ur/option.ur
+++ b/lib/ur/option.ur
@@ -59,3 +59,8 @@ fun unsafeGet [a] (o : option a) =
case o of
None => error <xml>Option.unsafeGet: encountered None</xml>
| Some v => v
+
+fun mapM [m] (_ : monad m) [a] [b] (f : a -> m b) (x : t a) : m (t b) =
+ case x of
+ None => return None
+ | Some y => z <- f y; return (Some z)