Make the specialiser handle polymorphic specialisation
Ticket #13873 (closed) unexpectedly showed that a SPECIALISE pragma made a program run (a lot) slower, because less specialisation took place overall. It turned out that the specialiser was missing opportunities because of quantified type variables.
It was quite easy to fix. The story is given in
Note [Specialising polymorphic dictionaries]
Two other minor fixes in the specialiser
-
There is no benefit in specialising data constructor /wrappers/. (They can appear overloaded because they are given a dictionary to store in the constructor.) Small guard in
canSpecImport
. -
There was a buglet in the
UnspecArg
case ofspecHeader
, in the case where there is a dead binder. We need a LitRubbish filler for thespecUnfolding
stuff. I expandedNote [Drop dead args from specialisations]
to explain.