Commit 90d66ded authored by Chris Martin's avatar Chris Martin Committed by Ben Gamari

Add doc to (<=<) comparing its type to (.)

This is another documentation addition similar to D1989, this time
comparing the type of the Kleisli composition operator (<=<) to that
of plain function composition (.).

Reviewers: hvr, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2100
parent c4a7520e
...@@ -104,7 +104,12 @@ infixr 1 <=<, >=> ...@@ -104,7 +104,12 @@ infixr 1 <=<, >=>
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> (a -> m c) (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> (a -> m c)
f >=> g = \x -> f x >>= g f >=> g = \x -> f x >>= g
-- | Right-to-left Kleisli composition of monads. @('>=>')@, with the arguments flipped -- | Right-to-left Kleisli composition of monads. @('>=>')@, with the arguments flipped.
--
-- Note how this operator resembles function composition @('.')@:
--
-- > (.) :: (b -> c) -> (a -> b) -> a -> c
-- > (<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
(<=<) :: Monad m => (b -> m c) -> (a -> m b) -> (a -> m c) (<=<) :: Monad m => (b -> m c) -> (a -> m b) -> (a -> m c)
(<=<) = flip (>=>) (<=<) = flip (>=>)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment