Skip to content
  • Simon Peyton Jones's avatar
    Make {-# UNPACK #-} work for type/data family invocations · 1ee1cd41
    Simon Peyton Jones authored
    This fixes most of Trac #3990.  Consider
      data family D a
      data instance D Double = CD Int Int
      data T = T {-# UNPACK #-} !(D Double)
    Then we want the (D Double unpacked).
    
    To do this we need to construct a suitable coercion, and it's much
    safer to record that coercion in the interface file, lest the in-scope
    instances differ somehow.  That in turn means elaborating the HsBang
    type to include a coercion.
    
    To do that I moved HsBang from BasicTypes to DataCon, which caused
    quite a few minor knock-on changes.
    
    Interface-file format has changed!
    
    Still to do: need to do knot-tying to allow instances to take effect
    within the same module.
    1ee1cd41