infix 4 (!=), (<), (<=), (>=), (>)
infixr 3 (&&), (&<&)
infixr 2 (||), orElse, morelse
-infixr 1 (>>=), (>>), (:=)
+infixr 1 (>>=), (>>), (:=), (>=>)
infixr 1 ($)
infixl 1 catch
(>>) :: 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> ()
sequence :: Monad m => f (m a) -> m (f a)
mapM f l = sequence (fmap f l)
+/// MonadE ///
+
+class (FunctorE m, Monad m) => MonadE m where
+ bindE :: m a -> (a -> <e> m b) -> <e> m b
+
+instance MonadE Maybe where
+ bindE Nothing _ = Nothing
+ bindE (Just v) f = f v
+
+instance MonadE (Either a) where
+ bindE (Left v) _ = Left v
+ bindE (Right v) f = f v
+
+instance MonadE [] where
+ bindE l f = concatMap f l
+
/// Category ///
"Identity function."