
13 Jul
2007
13 Jul
'07
8:36 p.m.
On Fri, Jul 13, 2007 at 09:19:58PM -0300, Felipe Almeida Lessa wrote:
On 7/13/07, Stefan O'Rear
wrote: instance Eval Int where ... seq (-1) b = b seq 0 b = b seq 1 b = b ...
I don't think you need all these cases. In fact, you can write
instance Eval Int where seq 0 b = b seq _ b = b [snip long explanation of why this is correct]
I thought of that, but decided that it would just obscure things, so I wrote out an infinite sequence of cases instead. This way it reinforces the symmetry of the instances and doesn't depend on an (often lacking) understanding of the pattern strictness rules. Both are equally valid. Stefan