Commit 4a736252 authored by kw217's avatar kw217
Browse files

[project @ 1999-03-24 12:29:05 by kw217]

Fix pretty-printing of FunTys to not throw away NoteTys (eg type synonyms).
parent 4f4d5030
......@@ -19,7 +19,7 @@ module PprType(
-- friends:
-- (PprType can see all the representations it's trying to print)
import Type ( Type(..), TyNote(..), Kind, ThetaType,
splitFunTys, splitDictTy_maybe,
splitDictTy_maybe,
splitForAllTys, splitSigmaTy, splitRhoTy,
isDictTy, splitTyConApp_maybe, splitFunTy_maybe,
boxedTypeKind
......@@ -180,12 +180,13 @@ ppr_ty env ctxt_prec ty@(ForAllTy _ _)
ppr_ty env ctxt_prec (FunTy ty1 ty2)
-- We fiddle the precedences passed to left/right branches,
-- so that right associativity comes out nicely...
= maybeParen ctxt_prec fUN_PREC (sep (ppr_ty env fUN_PREC ty1 : pp_rest))
= maybeParen ctxt_prec fUN_PREC (sep (ppr_ty env fUN_PREC ty1 : pp_rest ty2))
-- we don't want to lose usage annotations or synonyms,
-- so we can't use splitFunTys here.
where
(arg_tys, result_ty) = splitFunTys ty2
pp_rest = [ ptext SLIT("-> ") <> ppr_ty env fUN_PREC ty | ty <- arg_tys ++ [result_ty] ]
pp_rest (FunTy ty1 ty2) = pp_codom ty1 : pp_rest ty2
pp_rest ty = [pp_codom ty]
pp_codom ty = ptext SLIT("->") <+> ppr_ty env fUN_PREC ty
ppr_ty env ctxt_prec (AppTy ty1 ty2)
= maybeParen ctxt_prec tYCON_PREC $
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment