import Pretty
import ExternalCore
import Char
+import Encoding ( zEncodeString )
instance Show Module where
showsPrec d m = shows (pmodule m)
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)
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