Speaking of small functions

Donald Bruce Stewart dons at cse.unsw.edu.au
Sun Oct 29 23:13:52 EST 2006


duncan.coutts:
> On Sun, 2006-10-29 at 14:57 -0500, kahl at cas.mcmaster.ca wrote:
> >  > 
> >  > On 2006-10-29 at 09:30EST kahl at cas.mcmaster.ca  wrote:
> >  > >  > 
> >  > >  > Speaking of small functions, Kleisli composition should at least be in
> >  > >  > Control.Monad. It's a simple thing, and not commonly explicitly used
> >  > >  > at the moment, but rather important conceptually.
> >  > >  > 
> >  > >  > (@@) :: (Monad m) => (b -> m c) -> (a -> m b) -> (a -> m c)
> >  > >  > g @@ f = \x -> f x >>= g
> >  > > 
> >  > > I support this strongly.
> >  > > 
> >  > > My notation is (=>>=), to go with (>>=).
> >  > 
> >  > That's a better symbol for it. (@@) could be just about
> >  > anything, while (=>>=) is suggestive. Though I think what it
> >  > suggests might be with the arguments in a different order?
> > 
> > Yes, indeed! Thanks for pointing this out!
> > And I definitely prefer that order:
> > 
> > (=>>=) :: (a -> m b) -> (b -> m c) -> (a -> m c)
> 
> Ok. Let's have both (=>>=) and (=<<=).
> 
> If that's a consensus, then someone make a darcs patch with haddock
> documentation and a trac bug etc.
> 
> http://haskell.org/haskellwiki/Library_submissions

Before I or someone else rolls a patch for this, are there any other
similar functions that fit? 

I'm reminded of some of the things from the old Gofer CC prelude,

    http://www.cse.unsw.edu.au/~dons/data/cc.prelude

    (@@)             :: Monad m => (a -> m b) -> (c -> m a) -> (c -> m b)
    f @@ g            = join . map f . g

Do we have some references in the literature (a Mark Jones paper perhaps?)

-- Don


More information about the Libraries mailing list