aboutsummaryrefslogtreecommitdiff
path: root/src/Utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/Utils')
-rw-r--r--src/Utils/Maybe.elm7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Utils/Maybe.elm b/src/Utils/Maybe.elm
index 25d02e7..355ded9 100644
--- a/src/Utils/Maybe.elm
+++ b/src/Utils/Maybe.elm
@@ -1,5 +1,6 @@
module Utils.Maybe
( filterMaybe
+ , orElse
) where
filterMaybe : (a -> Bool) -> Maybe a -> Maybe a
@@ -11,3 +12,9 @@ filterMaybe cond maybe =
else Nothing
Nothing ->
Nothing
+
+orElse : Maybe a -> Maybe a -> Maybe a
+orElse mb1 mb2 =
+ case mb1 of
+ Just x -> Just x
+ Nothing -> mb2