[Haskell-cafe] arrow notation

Ross Paterson ross at soi.city.ac.uk
Tue Feb 12 15:12:31 CET 2013


On Mon, Feb 11, 2013 at 09:32:25AM +0100, Petr Pudlák wrote:
> While the implementation of Applicative can be defined without actually using
> `delay`:
> 
>     newtype ArrowApp a b c = ArrowApp (a b c)
> 
>     instance Arrow a => Functor (ArrowApp a b) where
>         fmap f (ArrowApp a) = ArrowApp (a >>^ f)
>     instance ArrowDelay a => Applicative (ArrowApp a b) where
>         pure x =
>             ArrowApp $ arr (const x)
>         (ArrowApp af) <*> (ArrowApp ax) =
>             ArrowApp $ (af &&& ax) >>^ uncurry ($)
> 
> I believe it only satisfies the laws only if the arrow satisfies delay/force
> laws.

This is a reader, which always satisfies the applicative laws.
What ArrowDelay does is pick out the arrows that are equivalent to
the static arrow, i.e. F(b->c), of some applicative functor F.



More information about the Haskell-Cafe mailing list