[Haskell-cafe] nice simple problem for someone struggling....
dave at zednenem.com
Fri Dec 21 13:41:57 EST 2007
On Dec 21, 2007 12:08 PM, Nicholls, Mark <Nicholls.Mark at mtvne.com> wrote:
> I thought from
> "Num numberType => SquareConstructor
> We could deduce that (in English rather than get Haskell and FOL
> all values of "SquareConstructor a"….the type of a would have be be in
> class Num?..
> is this not correct?....if not….why not?
That's a reasonable thing to assume. It just happens that Haskell doesn't
work that way. There's an asymmetry between constructing and
pattern-matching, and it's one that many people have complained about.
Personally, I never use class contexts in data declarations, simply because
it's too easy to get confused about what they do and do not guarantee.
Dave Menendez <dave at zednenem.com>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe