aboutsummaryrefslogtreecommitdiff
path: root/src/Utils
diff options
context:
space:
mode:
authorJoris Guyonvarch2015-03-21 12:50:45 +0100
committerJoris Guyonvarch2015-03-21 12:50:45 +0100
commita01687a3f0479734882eabed82bd100fc811b698 (patch)
tree7d764652bb57bb8983cf737fb3ab8ec6a9f59ec1 /src/Utils
parent29eac851219e36bccf2724b05d52b70438b5bf3f (diff)
Number from the top row are accepted too
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