
On 3/28/2014 6:56 PM, Brandon Allbery wrote:
It uses all of them to get the type, yes. And the more specific pattern must come first; the first one always matches in this case because `n` doesn't give it any way not to match. If you had warnings enabled, the compiler should have warned you that the second form wouldn't be matched (although you may also need optimization turned on).
I was wondering about that. I'll look for warning flags. I was loading into GHCi rather than running the compiler from the command line.
The compiler doesn't see the different implementations as independent, and in fact doesn't see multiple implementations of the function at all at type resolution time; it's translated to a single function applying `case` to the parameters to determine which clause of the body to evaluate.
Can they be spread out among different source files or be discontiguous within one file?