From 90d66dedc3a2d9b03dfd3dc3314d380e2adcf2ea Mon Sep 17 00:00:00 2001 From: Chris Martin Date: Sun, 10 Apr 2016 18:55:45 +0200 Subject: 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 --- libraries/base/Control/Monad.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'libraries/base') 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 (>=>) -- cgit v1.2.1