Use a Representaional coercion for data families
authorSimon Peyton Jones <simonpj@microsoft.com>
Wed, 24 Jun 2015 21:35:32 +0000 (22:35 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Fri, 26 Jun 2015 07:33:04 +0000 (08:33 +0100)
commitff8a67164b294b5eb6caee38ec59e7e400e025dc
tree66ff5cd8dd34c9c804fcf04dd0612063fde47f9d
parent9195927d093504e233225dfb40f2f6b95a78925e
Use a Representaional coercion for data families

When we have
  data instance T (a,b) = MkT a b
we make a represntation type
  data TPair a b = MkT a b
plus an axiom to connect the two
  ax a b :: T (a,b)  ~R  TPair a b

Previously this was a Nominal equality, and that worked ok
but seems illogical since Nominal equalities are between
types that the programmer thinks of as being equal.  But
TPair is not visible to the programmer; indeed we call it
the "representation TyCon".  So a Representational equality
seems more suitable here.
12 files changed:
compiler/hsSyn/HsUtils.hs
compiler/typecheck/FamInst.hs
compiler/typecheck/TcEvidence.hs
compiler/typecheck/TcExpr.hs
compiler/typecheck/TcGenGenerics.hs
compiler/typecheck/TcInstDcls.hs
compiler/typecheck/TcPat.hs
compiler/typecheck/TcUnify.hs
compiler/types/FamInstEnv.hs
compiler/types/TyCon.hs
compiler/vectorise/Vectorise/Generic/PAMethods.hs
compiler/vectorise/Vectorise/Generic/PData.hs