[commit: ghc] ghc-8.0: Add doc to (<=<) comparing its type to (.) (a7cb9cf)

git at git.haskell.org git at git.haskell.org
Sun Apr 10 22:16:58 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/a7cb9cf72ee1501b2a0558fd769d85db283dc08b/ghc

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

commit a7cb9cf72ee1501b2a0558fd769d85db283dc08b
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
    
    (cherry picked from commit 90d66dedc3a2d9b03dfd3dc3314d380e2adcf2ea)


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

a7cb9cf72ee1501b2a0558fd769d85db283dc08b
 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