
On Thursday 08 December 2005 07:33, you wrote:
seqPair $= (,)
or (the slightly less cryptic version)
seqPair x y $= (x, y)
Wouldn't they be different, the first one forcing (,) to WHNF (NOP), and the second one forcing x and y to WHNF?
No. Oh, $= also breaks type inferencing :) So you have to specify the type of the function explicitly.
Would you want seqPair written with $= to still have a type involving the Monad class?
That's the idea, yes. The type of the function does not change, only the way you write it changes when you use $= (again, this is all just a proposal at present).
This is not referentially transparent because it is not equivalent to
seqPair x y $= swap (y, x) where swap (a, b) = (b, a)
(can you see why not?)
Only guessing, because I am not sure what $= is supposed to do, but is it because y would be evaluated before x?
Yup. Well, that's one possible semantics of $=. A better semantics might reject the above expression as ambiguous.
Anyway, I didn't think my initial statement was so controversial. I even said "may", not "will".
Sure, I take your point. But I just jumped on my latest hobby-horse: verbosity of imperative code is not that necessary. -- Robin