On Mon, Nov 30, 2009 at 2:01 PM, michael rice <nowg...@yahoo.com> wrote: > > Hi all, > > A lot of things posted here I wasn't aware of. My original example involved > ~(x,y), so, > returning to that context, how would these two simple cases vary: > > add2 :: (Int,Int) -> Int > add2 (x,y) = x+y > > add2 :: (Int,Int) -> Int > add2 ~(x,y) = x+y > > I guess what I'm looking for is the concept that would dictate choosing one > over the other.
These particular two functions are identical, because (+) is strict for Ints. But consider these two functions: swap ~(x,y) = (y,x) swap' (x,y) = (y,x) swap is non-strict, and swap' is strict. swap _|_ = (_|_, _|_) swap' _|_ = _|_ -- Dave Menendez <d...@zednenem.com> <http://www.eyrie.org/~zednenem/> _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe