[commit: ghc] master: Add doc to (<=<) comparing its type to (.) (90d66de)

git at git.haskell.org git at git.haskell.org
Sun Apr 10 21:39:37 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/90d66dedc3a2d9b03dfd3dc3314d380e2adcf2ea/ghc

>---------------------------------------------------------------

commit 90d66dedc3a2d9b03dfd3dc3314d380e2adcf2ea
Author: Chris Martin <ch.martin at gmail.com>
Date:   Sun Apr 10 18:55:45 2016 +0200

    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


>---------------------------------------------------------------

90d66dedc3a2d9b03dfd3dc3314d380e2adcf2ea
 libraries/base/Control/Monad.hs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libraries/base/Control/Monad.hs b/libraries/base/Control/Monad.hs
index 9d858bd..a964581 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 (>=>)
 



More information about the ghc-commits mailing list