%
-% (c) The University of Glasgow 2001
+% (c) The University of Glasgow 2001-2006
%
-\begin{code}
+\begin{code}
module PprExternalCore () where
import Pretty
import ExternalCore
import Char
-import Encoding ( zEncodeString )
+import Encoding
instance Show Module where
showsPrec d m = shows (pmodule m)
indent = nest 2
pmodule (Module mname tdefs vdefgs) =
- (text "%module" <+> text (zEncodeString mname))
+ (text "%module" <+> text mname)
$$ indent ((vcat (map ((<> char ';') . ptdef) tdefs))
$$ (vcat (map ((<> char ';') . pvdefg) vdefgs)))
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)
pexp (Case e vb ty alts) = sep [text "%case" <+> parens (paty ty) <+> paexp e,
text "%of" <+> pvbind vb]
$$ (indent (braces (vcat (punctuate (char ';') (map palt alts)))))
-pexp (Coerce t e) = (text "%coerce" <+> paty t) $$ pexp e
+pexp (Cast e co) = (text "%cast" <+> pexp e) $$ paty co
pexp (Note s e) = (text "%note" <+> pstring s) $$ pexp e
pexp (External n t) = (text "%external" <+> pstring n) $$ paty t
pexp e = pfexp e