[Haskell-beginners] Applicative Composition

edgar klerks edgar.klerks at gmail.com
Thu Sep 30 19:47:09 EDT 2010


Hi All,

I was wondering, why there isn't a composition operator for applicative
functors. Of course it is rather trivial to implement, but it is a useful
feature:

{-# LANGUAGE FlexibleInstances, UndecidableInstances #-}
module ApplicativeComposition where
import Control.Applicative

class (Applicative f) =>  ApplicativeComposition f where
            (<.>) :: f (b -> c) -> f (a -> b) -> f (a -> c)

instance (Applicative f) => ApplicativeComposition f where
            (<.>) f g = pure (.) <*> f <*> g

Can this be added to later versions of haskell?

Greets,

Edgar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20100930/1aedb874/attachment.html


More information about the Beginners mailing list