RULES for SPECIALIZ(E)ations
Simon Peyton-Jones
simonpj at microsoft.com
Mon Oct 20 13:01:59 EDT 2003
|
| I suppose I'm being bitten by User's Guide 7.8.2:
|
| "If more than one rule matches a call, GHC will choose one
arbitrarily
| to apply."
|
| even if a bit later it says:
|
| "So a rule only matches if the types match too."
|
| Am I understanding right and it's that so?
I think so. After all, the types match for count/generic too.
Maybe you want a rule
genericLength = length
which will replace a call to (genericLength at type Int) by a call to
length?
You can also use "phases" to control order of rule application (albeit
it's crude).
http://www.haskell.org/ghc/docs/latest/html/users_guide/pragmas.html#PHA
SE-CONTROL
Simon
More information about the Glasgow-haskell-users
mailing list