]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
(refs #7751) Added orElseM 29/1429/1
authorHannu Niemistö <hannu.niemisto@semantum.fi>
Wed, 7 Feb 2018 12:20:34 +0000 (14:20 +0200)
committerHannu Niemistö <hannu.niemisto@semantum.fi>
Wed, 7 Feb 2018 12:20:34 +0000 (14:20 +0200)
Change-Id: I365c89a1d4ad60b1763854b6d6cd0a3a94e1ab49

bundles/org.simantics.scl.runtime/scl/Prelude.scl

index 7e558bdc4fd0c5d1216675919f5465b0042391b1..2be6ed745e7a9edf90c5519d99291763c007b33c 100644 (file)
@@ -1305,6 +1305,11 @@ orElse :: Maybe a -> (<e> a) -> <e> a
 orElse (Just x) _   = x
 orElse Nothing  def = def
 
+@inline
+orElseM :: Maybe a -> (<e> Maybe a) -> <e> Maybe a
+orElseM mx@(Just x) _   = mx
+orElseM Nothing     def = def
+
 /// Either ///
 
 """