Note [Specialisations already covered]
We obviously don't want to generate two specialisations for the same
argument pattern. Wrinkles
(SC1) We do the already-covered test in specDefn, not when we generate
the CallInfo in mkCallUDs. We used to test in the latter place, but
we now iterate the specialiser somewhat, and the Id at the call site
might therefore not have all the RULES that we can see in specDefn
(SC2) What about two specialisations where the second is an *instance*
of the first? It's a bit arbitrary, but here's what we do:
* If the existing one is user-specified, via a SPECIALISE pragma, we
suppress the further specialisation.
* If the existing one is auto-generated, we generate a second RULE
for the more specialised version.
The latter is important because we don't want the accidental order
of calls to determine what specialisations we generate.
(SC3) Annoyingly, we /also/ eliminate duplicates in `filterCalls`.
See (MP3) in Note [Specialising polymorphic dictionaries] References 1
- Specialising polymorphic dictionaries GHC.Core.Opt.Specialise
Referenced by 3
- GHC.Core.Opt.Specialise call site ×3