[Haskell-cafe] Non-Overlapping Patterns

Andrew Coppin andrewcoppin at btinternet.com
Mon May 5 11:07:46 EDT 2008


PR Stanley wrote:
> To put it another way, why doesn't the interpreter identify the more 
> specific cases and put them before the general ones.

I'm guessing because determining which equation is the "most general" is 
equivilent to the Halting Problem in the general case. (Notice that 
Mathematica does almost exactly the same thing: it has a few heuristics 
for figuring out what is more general, but beyond that it uses the order 
you specify.)

As to how function application is actually implemented - well, that 
depends on what you're using to run your Haskell. ;-) I believe GHC uses 
pointer blocks rather than switch blocks (loosely speaking).



More information about the Haskell-Cafe mailing list