Make {-# UNPACK #-} work for type/data family invocations
authorSimon Peyton Jones <simonpj@microsoft.com>
Sun, 23 Dec 2012 15:38:48 +0000 (15:38 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Sun, 23 Dec 2012 15:38:48 +0000 (15:38 +0000)
commit1ee1cd4194555e498d05bfc391b7b0e635d11e29
tree96db09d1078848cd4a9ef66972fb3d5310512b03
parentd3e2912ac2048346828539e0dfef6c0cefef0d38
Make {-# UNPACK #-} work for type/data family invocations

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.
18 files changed:
compiler/basicTypes/BasicTypes.lhs
compiler/basicTypes/DataCon.lhs
compiler/basicTypes/MkId.lhs
compiler/hsSyn/HsTypes.lhs
compiler/iface/BinIface.hs
compiler/iface/BuildTyCl.lhs
compiler/iface/IfaceSyn.lhs
compiler/iface/MkIface.lhs
compiler/iface/TcIface.lhs
compiler/main/PprTyThing.hs
compiler/prelude/TysWiredIn.lhs
compiler/simplCore/Simplify.lhs
compiler/stranal/DmdAnal.lhs
compiler/typecheck/TcRnDriver.lhs
compiler/typecheck/TcSplice.lhs
compiler/typecheck/TcTyClsDecls.lhs
compiler/vectorise/Vectorise/Generic/PData.hs
compiler/vectorise/Vectorise/Type/TyConDecl.hs