[Haskell-cafe] Simplification of this function?
Max Rabkin
max.rabkin at gmail.com
Fri Jan 16 13:07:20 EST 2009
2009/1/16 Andrew Wagner <wagner.andrew at gmail.com>:
> I've been playing around with this, but haven't been able to come up with
> anything.
> myFunc f (a,b) (c,d) = (f a c, f b d)
> It feels as if there should be a nice simple version of this using some
> combination of {un,}curry, "on", &&&, ***, or something else.
> Any thoughts?
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
uncurry (***) ((first f).(second f) $ (a, b)) (c, d) == uncurry (***)
(f a, f b) (c, d) == (f a *** f b) (c, d) == (f a c, f b d) == myFunc
f (a, b) (c, d), if I'm not mistaken.
Removing the points:
uncurry (***) ((first f).(second f) $ (a, b)) == myFunc f (a, b)
uncurry (***) . ((first f) . (second f)) == myFunc f
uncurry (***) . (first f) . (second f) == myFunc f (associativity of (.))
--Max
More information about the Haskell-Cafe
mailing list