Skip to content

Make the specialiser handle polymorphic specialisation

Simon Peyton Jones requested to merge wip/T13873 into master

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 of specHeader, in the case where there is a dead binder. We need a LitRubbish filler for the specUnfolding stuff. I expanded Note [Drop dead args from specialisations] to explain.

Merge request reports