data instance T [a] where
T1 :: forall b. b -> T [Maybe b]
-Hence
- Co7T a :: T [a] ~ :R7T a
-Now we want
+Hence we translate to
-- Wrapper
$WT1 :: forall b. b -> T [Maybe b]
-- Worker
T1 :: forall c b. (c ~ Maybe b) => b -> :R7T c
+ -- Coercion from family type to representation type
+ Co7T a :: T [a] ~ :R7T a
+
\begin{code}
mkDataConIds :: Name -> Name -> DataCon -> DataConIds
mkDataConIds wrap_name wkr_name data_con
`setSpecInfo` mkSpecInfo [seq_cast_rule]
- ty = mkForAllTys [alphaTyVar,openBetaTyVar]
- (mkFunTy alphaTy (mkFunTy openBetaTy openBetaTy))
- [x,y] = mkTemplateLocals [alphaTy, openBetaTy]
- rhs = mkLams [alphaTyVar,openBetaTyVar,x,y] (Case (Var x) x openBetaTy [(DEFAULT, [], Var y)])
+ ty = mkForAllTys [alphaTyVar,argBetaTyVar]
+ (mkFunTy alphaTy (mkFunTy argBetaTy argBetaTy))
+ [x,y] = mkTemplateLocals [alphaTy, argBetaTy]
+ rhs = mkLams [alphaTyVar,argBetaTyVar,x,y] (Case (Var x) x argBetaTy [(DEFAULT, [], Var y)])
-- See Note [Built-in RULES for seq]
seq_cast_rule = BuiltinRule { ru_name = fsLit "seq of cast"