
If we look at swap from the standpoint of the laws/RULES it should support,
viewing Hask over (,) as a symmetric monoidal category you get something
like:
{-# RULES"swap . swap = id" forall x. swap (swap x) = x
"fst . swap = snd" forall x. fst (swap x) = snd x
"snd . swap = fst" forall x. snd (swap x) = fst x
#-}
That seems to argue for the lazy definition being the default to avoid the
strict pattern match in swap breaking the latter very pleasing equalities.
-Edward Kmett
On Wed, Jun 17, 2009 at 8:52 PM,
How about this: swap should be lazy because that is how H98 defines uncurry:
uncurry :: (a -> b -> c) -> ((a, b) -> c) uncurry f p = f (fst p) (snd p)
-- Russell O'Connor http://r6.ca/ ``All talk about `theft,''' the general counsel of the American Graphophone Company wrote, ``is the merest claptrap, for there exists no property in ideas musical, literary or artistic, except as defined by statute.'' _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries