On 23/09/2006, at 4:33 AM, Christian Sievers wrote:
Hello,
I don't take my advice to go to haskell-cafe :-)
I will take your advice :)
The discussion continued outside the mailing list, and now I have
two questions myself:
1. Why do the rules of the monomorphism restriction explicitly mention
*simple* pattern bindings?
Where is the difference, especially as there is a translation to
simple pattern bindings?
Why should
p | "a"=="b" = 2
| otherwise = 3
be treated different than
p = if "a"=="b" then 2 else 3
They are the same (both are simple pattern bindings). The report says
in section 4.4.3.2 that the first can be translated into the second.
A simple pattern binding is one where the lhs is a variable only.
If a pattern binding is not simple, it must have a data constructor
on the lhs, therefore it cannot be overloaded. So the (dreaded) MR only
applies to simple pattern bindings.
Cheers,
Bernie.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe