- mb_family
- = do { -- We need to tie a knot as the coercion of a data instance depends
- -- on the instance representation tycon and vice versa.
- ; tycon <- fixM (\ tycon_rec -> do
- { parent <- mkParentInfo mb_family tc_name tvs tycon_rec
- ; let { tycon = mkAlgTyCon tc_name kind tvs stupid_theta rhs
- parent is_rec want_generics gadt_syn
- ; kind = mkArrowKinds (map tyVarKind tvs) liftedTypeKind
- }
- ; return tycon
- })
- ; return tycon
- }
-
--- If a family tycon with instance types is given, the current tycon is an
+ parent mb_family
+ | Just fam_inst_info <- mb_family
+ = -- We need to tie a knot as the coercion of a data instance depends
+ -- on the instance representation tycon and vice versa.
+ ASSERT( isNoParent parent )
+ fixM $ \ tycon_rec -> do
+ { fam_parent <- mkFamInstParentInfo tc_name tvs fam_inst_info tycon_rec
+ ; return (mkAlgTyCon tc_name kind tvs stupid_theta rhs
+ fam_parent is_rec want_generics gadt_syn) }
+
+ | otherwise
+ = return (mkAlgTyCon tc_name kind tvs stupid_theta rhs
+ parent is_rec want_generics gadt_syn)
+ where
+ kind = mkArrowKinds (map tyVarKind tvs) liftedTypeKind
+
+-- | If a family tycon with instance types is given, the current tycon is an