-ppr_ty env ctxt_prec (SynTy tycon tys expansion)
- | codeStyle (pStyle env)
- -- always expand types that squeak into C-variable names
- = ppr_ty env ctxt_prec expansion
-
- | otherwise
- = (<>)
- (ppr_app env ctxt_prec (ppr_tycon env tycon) tys)
- (ifPprShowAll (pStyle env) (hsep [text " {- expansion:",
- ppr_ty env tOP_PREC expansion,
- text "-}"]))
-
-ppr_ty env ctxt_prec (DictTy clas ty usage)
- = braces (ppr_dict env tOP_PREC (clas, ty))
- -- Curlies are temporary
-
-
--- Some help functions
-ppr_corner env ctxt_prec (TyConTy tycon usage) arg_tys
- | isFunTyCon tycon && length arg_tys == 2
- = ppr_ty env ctxt_prec (FunTy ty1 ty2 usage)
- where
- (ty1:ty2:_) = arg_tys
-
-ppr_corner env ctxt_prec (TyConTy tycon usage) arg_tys
- | isTupleTyCon tycon
- && not (codeStyle (pStyle env)) -- no magic in that case
- && length arg_tys == tyConArity tycon -- no magic if partially applied
- = parens arg_tys_w_commas
- where
- arg_tys_w_commas = hsep (punctuate comma (map (ppr_ty env tOP_PREC) arg_tys))
-
-ppr_corner env ctxt_prec (TyConTy tycon usage) arg_tys
- | not (codeStyle (pStyle env)) && uniqueOf tycon == listTyConKey
- = ASSERT(length arg_tys == 1)
- brackets (ppr_ty env tOP_PREC ty1)
- where
- (ty1:_) = arg_tys
-
-ppr_corner env ctxt_prec (TyConTy tycon usage) arg_tys
- = ppr_app env ctxt_prec (ppr_tycon env tycon) arg_tys
-
-ppr_corner env ctxt_prec (TyVarTy tyvar) arg_tys
- = ppr_app env ctxt_prec (pTyVarO env tyvar) arg_tys
-
-
-ppr_app env ctxt_prec pp_fun []
- = pp_fun
-ppr_app env ctxt_prec pp_fun arg_tys
- = maybeParen ctxt_prec tYCON_PREC (hsep [pp_fun, arg_tys_w_spaces])
- where
- arg_tys_w_spaces = hsep (map (ppr_ty env tYCON_PREC) arg_tys)