]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.runtime/scl/Prelude.scl
(refs #7506) Added >=> operator to Prelude
[simantics/platform.git] / bundles / org.simantics.scl.runtime / scl / Prelude.scl
index 77e62c8582215cb6a4afcd3c4d65e26275bac0f1..05b5f2785675c6da8738e28287a465b6f8c22d4f 100644 (file)
@@ -74,7 +74,7 @@ infixl 5  (\\), (<<), (<+)
 infix  4  (!=), (<), (<=), (>=), (>)
 infixr 3  (&&), (&<&)
 infixr 2  (||), orElse, morelse
-infixr 1  (>>=), (>>), (:=)
+infixr 1  (>>=), (>>), (:=), (>=>)
 infixr 1  ($)
 infixl 1  catch
 
@@ -921,6 +921,10 @@ Sequentially compose two actions, discarding any value produced by the first, li
 (>>) :: Monad m => m a -> m b -> m b
 a >> b = a >>= (\_ -> b)
 
+"Left-to-right Kleisli composition of monads."
+(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> (a -> m c)
+(f >=> g) x = (f x) >>= g 
+
 "While loop. `while cond body` executes the `body` while the `cond` is true." 
 @inline
 while :: (<e> Boolean) -> (<e> a) -> <e> ()