summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorChris Martin <ch.martin@gmail.com>2016-04-10 18:55:45 +0200
committerBen Gamari <ben@smart-cactus.org>2016-04-10 20:09:03 +0200
commit90d66dedc3a2d9b03dfd3dc3314d380e2adcf2ea (patch)
treeee072de893f7929253fe5644b05bb76fc1d9fec2 /libraries
parentc4a7520ef3a0b5e0e33d66ae1d628af93e0d7590 (diff)
downloadhaskell-90d66dedc3a2d9b03dfd3dc3314d380e2adcf2ea.tar.gz
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
Diffstat (limited to 'libraries')
-rw-r--r--libraries/base/Control/Monad.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/libraries/base/Control/Monad.hs b/libraries/base/Control/Monad.hs
index 9d858bd332..a964581fef 100644
--- a/libraries/base/Control/Monad.hs
+++ b/libraries/base/Control/Monad.hs
@@ -104,7 +104,12 @@ infixr 1 <=<, >=>
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> (a -> m c)
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)
(<=<) = flip (>=>)