Skip to content
  • Simon Peyton Jones's avatar
    Fix 'SPECIALISE instance' · 1a4c04b1
    Simon Peyton Jones authored
    Trac #12944 showed that the DsBinds code that implemented a
    SPECIALISE pragma was inadequate if the constraints solving
    added let-bindings for dictionaries.  The result was that
    we ended up with an unbound dictionary in a DFunUnfolding -- and
    Lint didn't even check for that!
    
    Fixing this was not entirely straightforward
    
    * In DsBinds.dsSpec we use a new function
         TcEvidence.collectHsWrapBinders
      to pick off the lambda binders from the HsWapper
    
    * dsWrapper now returns a (CoreExpr -> CoreExpr) function
    
    * CoreUnfold.specUnfolding now takes a (CoreExpr -> CoreExpr)
      function it can use to specialise the unfolding.
    
    On the whole the code is simpler than before.
    1a4c04b1