On Dec 21, 2007 12:08 PM, Nicholls, Mark <Nicholls.Mark@mtvne.com> wrote:

I thought from

 

"Num numberType => SquareConstructor
numberType"

 

We could deduce that (in English rather than get Haskell and FOL confusion)

 

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@zednenem.com>
<http://www.eyrie.org/~zednenem/>