X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FcoreSyn%2FPprExternalCore.lhs;h=8e9dbfea8a93d3fe53f933d164e7b7b91d2a2d79;hb=25ce05f745a40a57ff64f8ee3d59a31ba61400fc;hp=26c89cce486982a791e87272cfc1fa634ee8fd7f;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1;p=ghc-hetmet.git diff --git a/compiler/coreSyn/PprExternalCore.lhs b/compiler/coreSyn/PprExternalCore.lhs index 26c89cc..8e9dbfe 100644 --- a/compiler/coreSyn/PprExternalCore.lhs +++ b/compiler/coreSyn/PprExternalCore.lhs @@ -8,6 +8,7 @@ module PprExternalCore () where import Pretty import ExternalCore import Char +import Encoding ( zEncodeString ) instance Show Module where showsPrec d m = shows (pmodule m) @@ -59,10 +60,10 @@ pcdef (Constr dcon tbinds tys) = pcdef (GadtConstr dcon ty) = (pname dcon) <+> text "::" <+> pty ty -pname id = text id +pname id = text (zEncodeString id) pqname ("",id) = pname id -pqname (m,id) = pname m <> char '.' <> pname id +pqname (m,id) = text m <> char '.' <> pname id ptbind (t,Klifted) = pname t ptbind (t,k) = parens (pname t <> text "::" <> pkind k) @@ -95,12 +96,15 @@ pappty t ts = sep (map paty (t:ts)) pforall tbs (Tforall tb t) = pforall (tbs ++ [tb]) t pforall tbs t = hsep (map ptbind tbs) <+> char '.' <+> pty t -pvdefg (Rec vtes) = text "%rec" $$ braces (indent (vcat (punctuate (char ';') (map pvte vtes)))) -pvdefg (Nonrec vte) = pvte vte +pvdefg (Rec vdefs) = text "%rec" $$ braces (indent (vcat (punctuate (char ';') (map pvdef vdefs)))) +pvdefg (Nonrec vdef) = pvdef vdef -pvte (v,t,e) = sep [pname v <+> text "::" <+> pty t <+> char '=', +pvdef (l,v,t,e) = sep [plocal l <+> pname v <+> text "::" <+> pty t <+> char '=', indent (pexp e)] +plocal True = text "%local" +plocal False = empty + paexp (Var x) = pqname x paexp (Dcon x) = pqname x paexp (Lit l) = plit l