]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.runtime/scl/Prelude.scl
Improve Databoard's dynamically typed data capabilities.
[simantics/platform.git] / bundles / org.simantics.scl.runtime / scl / Prelude.scl
index b29b04a2fe42025c1538637f10080c921e4bf12f..4c20c99b52dfe03528542ab582934a9fe7185ec3 100644 (file)
@@ -1266,7 +1266,7 @@ instance MonadZero Maybe where
     mzero = Nothing
 
 instance MonadOr Maybe where
-    morelse (Just a) _ = Just a
+    morelse a@(Just _) _ = a
     morelse _ b = b
 
 "`execJust v f` executes the function `f` with parameter value `x`, if `v=Just x`. If `v=Nothing`, the function does nothing."
@@ -2294,6 +2294,9 @@ importJava "org.simantics.databoard.binding.mutable.Variant" where
     @JavaName getComponent
     variantComponent :: Variant -> ChildReference -> Variant
 
+variant :: Serializable a => a -> Variant
+variant v = variantOfWithBinding binding v
+
 variantValue :: Serializable a => Variant -> a
 variantValue v = variantValue_ v binding