David Menendez | 21 Dec 19:41
Gravatar

Re: nice simple problem for someone struggling....



On Dec 21, 2007 12:08 PM, Nicholls, Mark <Nicholls.Mark <at> 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 <at> zednenem.com>
<http://www.eyrie.org/~zednenem/>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Gmane