30 Nov
2009
30 Nov
'09
7:29 p.m.
On Mon, Nov 30, 2009 at 2:01 PM, michael rice <nowgate@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 <dave@zednenem.com> <http://www.eyrie.org/~zednenem/>