External Core: print function types correctly, improve newtype pretty-printing
authorTim Chevalier <chevalier@alum.wellesley.edu>
Fri, 28 Mar 2008 22:26:30 +0000 (22:26 +0000)
committerTim Chevalier <chevalier@alum.wellesley.edu>
Fri, 28 Mar 2008 22:26:30 +0000 (22:26 +0000)
- In a previous patch I broke the printing of fully-applied arrow
types (e.g., "a -> b" was "(ghczmprim:GHCziPrim a b)") by z-encoding
package names and not updating the primitive module name as defined in
External Core accordingly. Fixed. (Mega sigh...)

- Make newtype decls print slightly more readably.

compiler/coreSyn/ExternalCore.lhs
compiler/coreSyn/PprExternalCore.lhs

index 5754f84..2a8d152 100644 (file)
@@ -86,7 +86,7 @@ type Id = String
 primMname :: Mname
 -- For truly horrible reasons, this must be z-encoded.
 -- With any hope, the z-encoding will die soon.
 primMname :: Mname
 -- For truly horrible reasons, this must be z-encoded.
 -- With any hope, the z-encoding will die soon.
-primMname = "ghc-prim:GHCziPrim"
+primMname = "ghczmprim:GHCziPrim"
 
 tcArrow :: Qual Tcon
 tcArrow = (primMname, "(->)")
 
 tcArrow :: Qual Tcon
 tcArrow = (primMname, "(->)")
index dd75b62..791e36b 100644 (file)
@@ -61,7 +61,7 @@ ptdef (Newtype tcon tbinds (coercion,k) rep) =
 -- At the same time, we need the newtype decl to declare the tycon itself.
 -- Sigh.
   text "%newtype" <+> pqname tcon <+> (hsep (map ptbind tbinds)) 
 -- At the same time, we need the newtype decl to declare the tycon itself.
 -- Sigh.
   text "%newtype" <+> pqname tcon <+> (hsep (map ptbind tbinds)) 
-    <+> axiomclause <+> repclause
+    $$ indent (axiomclause $$ repclause)
        where  axiomclause = char '^' <+> parens (pqname coercion <+> text "::"
                                      <+> pkind k)
               repclause   = case rep of
        where  axiomclause = char '^' <+> parens (pqname coercion <+> text "::"
                                      <+> pkind k)
               repclause   = case rep of