
12 Feb
2009
12 Feb
'09
3:19 a.m.
On Thu, Feb 12, 2009 at 8:46 AM, Kim-Ee Yeoh
On the same note, does anyone have ideas for the following snippet? Tried the pointfree package but the output was useless.
pointwise op (x0,y0) (x1,y1) = (x0 `op` x1, y0 `op` y1)
import Control.Monad.Reader -- for the (Monad (a ->)) instance import Control.Bifunctor -- package category-extras dup = join (,) mapPair = uncurry bimap pointfree = (mapPair .) . mapPair . dup Or if you're not afraid of *some* points, and want to avoid the imports: dup x = (x,x) mapPair (f,g) (x,y) = (f x, g y) pointfree op = mapPair . mapPair (dup op) That what you're looking for? :-) - Benja