[Haskell-cafe] nice simple problem for someone struggling....

David Menendez 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
> 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/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20071221/4dba87bb/attachment.htm


More information about the Haskell-Cafe mailing list