X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FhsSyn%2FHsTypes.lhs;h=bbe701624c6886ab064af5137172550fbc0be0f4;hp=1ec096671f11f3bff136651fbc751001e5c8b825;hb=84923cc7de2a93c22a2f72daf9ac863959efae13;hpb=ab22f4e6456820c1b5169d75f5975a94e61f54ce diff --git a/compiler/hsSyn/HsTypes.lhs b/compiler/hsSyn/HsTypes.lhs index 1ec0966..bbe7016 100644 --- a/compiler/hsSyn/HsTypes.lhs +++ b/compiler/hsSyn/HsTypes.lhs @@ -102,7 +102,8 @@ type HsContext name = [LHsPred name] type LHsPred name = Located (HsPred name) -data HsPred name = HsClassP name [LHsType name] +data HsPred name = HsClassP name [LHsType name] -- class constraint + | HsEqualP (LHsType name) (LHsType name)-- equality constraint | HsIParam (IPName name) (LHsType name) type LHsType name = Located (HsType name) @@ -268,9 +269,6 @@ splitHsFunType other = ([], other) %* * %************************************************************************ -NB: these types get printed into interface files, so - don't change the printing format lightly - \begin{code} instance (OutputableBndr name) => Outputable (HsType name) where ppr ty = pprHsType ty @@ -280,8 +278,13 @@ instance (Outputable name) => Outputable (HsTyVarBndr name) where ppr (KindedTyVar name kind) = pprHsTyVarBndr name kind instance OutputableBndr name => Outputable (HsPred name) where - ppr (HsClassP clas tys) = ppr clas <+> hsep (map (pprParendHsType.unLoc) tys) - ppr (HsIParam n ty) = hsep [ppr n, dcolon, ppr ty] + ppr (HsClassP clas tys) = ppr clas <+> hsep (map pprLHsType tys) + ppr (HsEqualP t1 t2) = hsep [pprLHsType t1, ptext SLIT("~"), + pprLHsType t2] + ppr (HsIParam n ty) = hsep [ppr n, dcolon, ppr ty] + +pprLHsType :: OutputableBndr name => LHsType name -> SDoc +pprLHsType = pprParendHsType . unLoc pprHsTyVarBndr :: Outputable name => name -> Kind -> SDoc pprHsTyVarBndr name kind | isLiftedTypeKind kind = ppr name @@ -339,7 +342,6 @@ ppr_mono_ty ctxt_prec (HsForAllTy exp tvs ctxt ty) = maybeParen ctxt_prec pREC_FUN $ sep [pprHsForAll exp tvs ctxt, ppr_mono_lty pREC_TOP ty] --- gaw 2004 ppr_mono_ty ctxt_prec (HsBangTy b ty) = ppr b <> ppr ty ppr_mono_ty ctxt_prec (HsTyVar name) = ppr name ppr_mono_ty ctxt_prec (HsFunTy ty1 ty2) = ppr_fun_ty ctxt_prec ty1 ty2 @@ -347,7 +349,7 @@ ppr_mono_ty ctxt_prec (HsTupleTy con tys) = tupleParens con (interpp'SP tys) ppr_mono_ty ctxt_prec (HsKindSig ty kind) = parens (ppr_mono_lty pREC_TOP ty <+> dcolon <+> pprKind kind) ppr_mono_ty ctxt_prec (HsListTy ty) = brackets (ppr_mono_lty pREC_TOP ty) ppr_mono_ty ctxt_prec (HsPArrTy ty) = pabrackets (ppr_mono_lty pREC_TOP ty) -ppr_mono_ty ctxt_prec (HsPredTy pred) = braces (ppr pred) +ppr_mono_ty ctxt_prec (HsPredTy pred) = ppr pred ppr_mono_ty ctxt_prec (HsNumTy n) = integer n -- generics only ppr_mono_ty ctxt_prec (HsSpliceTy s) = pprSplice s