X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FcoreSyn%2FPprExternalCore.lhs;h=ded798ccff5256a2b9befdf94a87f60fa7e4320e;hp=26c89cce486982a791e87272cfc1fa634ee8fd7f;hb=17b297d97d327620ed6bfab942f8992b2446f1bf;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1 diff --git a/compiler/coreSyn/PprExternalCore.lhs b/compiler/coreSyn/PprExternalCore.lhs index 26c89cc..ded798c 100644 --- a/compiler/coreSyn/PprExternalCore.lhs +++ b/compiler/coreSyn/PprExternalCore.lhs @@ -1,13 +1,21 @@ % -% (c) The University of Glasgow 2001 +% (c) The University of Glasgow 2001-2006 % + \begin{code} +{-# OPTIONS_GHC -w #-} +-- The above warning supression flag is a temporary kludge. +-- While working on this module you are encouraged to remove it and fix +-- any warnings in the module. See +-- http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions#Warnings +-- for details module PprExternalCore () where import Pretty import ExternalCore import Char +import Encoding instance Show Module where showsPrec d m = shows (pmodule m) @@ -59,10 +67,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) @@ -75,6 +83,7 @@ pakind (Kopen) = char '?' pakind k = parens (pkind k) pkind (Karrow k1 k2) = parens (pakind k1 <> text "->" <> pkind k2) +pkind (Keq t1 t2) = parens (pty t1 <> text ":=:" <> pty t2) pkind k = pakind k paty (Tvar n) = pname n @@ -95,12 +104,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 @@ -128,9 +140,11 @@ pexp (Let vd e) = (text "%let" <+> pvdefg vd) $$ (text "%in" <+> pexp e) 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" <+> parens (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 (External n cc t) = (text "%external" <+> text cc <+> pstring n) $$ paty t +pexp (DynExternal cc t) = (text "%dynexternal" <+> text cc) $$ paty t +pexp (Label n) = (text "%label" <+> pstring n) pexp e = pfexp e