> import Control.Applicative
> 
> data Pair a = a :*: a
> 
> instance Functor Pair where
>       f `fmap` (x :*: y) = f x :*: f y
> 
> instance Applicative Pair where
>       (f :*: g) <*> (x :*: y) = f x :*: f y

The last f needs to be a g.

>       pure x = x :*: x
> 
> pointfree :: (a -> b -> c) -> Pair a -> Pair b -> Pair c
> --pointfree o x y = pure o <*> x <*> y
> pointfree = ((<*>) .) . (<*>) . pure
> -- in the applicative paper notation:
> --pointfree o x y = [| o x y |]

Very nice. Aside: I wonder how much work it would be to
extend the pointfree tool to infer such equalities?

-- 
View this message in context: 
http://www.nabble.com/Looking-for-pointfree-version-tp21913653p22027350.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to