Proposal: Adding Kleisli composition to Control.Monad

Donald Bruce Stewart dons at cse.unsw.edu.au
Mon Nov 13 20:18:06 EST 2006


taralx:
> On 11/13/06, Taral <taralx at gmail.com> wrote:
> >On 11/13/06, Donald Bruce Stewart <dons at cse.unsw.edu.au> wrote:
> >> >     (>=>) :: (Monad m) => (a -> m b) -> (b -> m c) -> (a -> m c)
> >> >     (<=<) :: (Monad m) => (b -> m c) -> (a -> m b) -> (a -> m c)
> >>
> >> Does anyone have an opinion about these guys? :)
> >
> >I want them. See my timeout patch for a case where I wanted one of
> >these and didn't have it (the catch filter expression).
> 
> Actually, my tests indicate that (>>>) and (<<<) can be used for any
> Monad. So are we defining these again?

Do you mean that we should just import Control.Arrow and use that?
Something like:

    import Control.Arrow

    main :: IO ()
    main = (x >>> y) 7

    x :: Integer -> IO ()
    x = print

    y :: a -> IO ()
    y = const (return ())

-- Don


More information about the Libraries mailing list