From: Hannu Niemistö Date: Mon, 25 Sep 2017 13:05:39 +0000 (+0300) Subject: (refs #7506) Added >=> operator to Prelude X-Git-Tag: v1.31.0~170 X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=commitdiff_plain;h=8cd3ef9676a44b623c7d5d30345fa21f4a5aef35 (refs #7506) Added >=> operator to Prelude Change-Id: I4e395bd3d2bc2f49741e66dab3bf9175cfb1bc9a --- diff --git a/bundles/org.simantics.scl.runtime/scl/Prelude.scl b/bundles/org.simantics.scl.runtime/scl/Prelude.scl index 77e62c858..05b5f2785 100644 --- a/bundles/org.simantics.scl.runtime/scl/Prelude.scl +++ b/bundles/org.simantics.scl.runtime/scl/Prelude.scl @@ -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 :: ( Boolean) -> ( a) -> ()