summaryrefslogtreecommitdiff
path: root/compiler/coreSyn
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2013-01-02 15:48:29 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2013-01-02 15:48:29 +0000
commit3fa7340faa32ebf3ac2c437e3d278fd634b3ad76 (patch)
tree6afead5c0825bb21cff2453fac121e0ca59b3014 /compiler/coreSyn
parent3f7b147c41a83bb69e2cd2337994434bf2507ef3 (diff)
downloadhaskell-3fa7340faa32ebf3ac2c437e3d278fd634b3ad76.tar.gz
De-tab PprExternalCore
Diffstat (limited to 'compiler/coreSyn')
-rw-r--r--compiler/coreSyn/PprExternalCore.lhs43
1 files changed, 21 insertions, 22 deletions
diff --git a/compiler/coreSyn/PprExternalCore.lhs b/compiler/coreSyn/PprExternalCore.lhs
index a1c0fc5150..4ca4385ce1 100644
--- a/compiler/coreSyn/PprExternalCore.lhs
+++ b/compiler/coreSyn/PprExternalCore.lhs
@@ -4,7 +4,6 @@
\begin{code}
{-# OPTIONS_GHC -fno-warn-orphans #-}
-{-# OPTIONS -fno-warn-tabs #-}
-- The above warning supression flag is a temporary kludge.
-- While working on this module you are encouraged to remove it and
-- detab the module (please do the detabbing in a separate patch). See
@@ -55,7 +54,7 @@ pmodule :: Module -> Doc
pmodule (Module mname tdefs vdefgs) =
(text "%module" <+> text mname)
$$ indent ((vcat (map ((<> char ';') . ptdef) tdefs))
- $$ (vcat (map ((<> char ';') . pvdefg) vdefgs)))
+ $$ (vcat (map ((<> char ';') . pvdefg) vdefgs)))
ptdef :: Tdef -> Doc
ptdef (Data tcon tbinds cdefs) =
@@ -145,7 +144,7 @@ pvdef :: Vdef -> Doc
-- Right now, the local flag is never used, because the Core doc doesn't
-- explain the meaning of %local.
pvdef (_l,v,t,e) = sep [(pqname v <+> text "::" <+> pty t <+> char '='),
- indent (pexp e)]
+ indent (pexp e)]
paexp, pfexp, pexp :: Exp -> Doc
paexp (Var x) = pqname x
@@ -156,7 +155,7 @@ paexp e = parens(pexp e)
plamexp :: [Bind] -> Exp -> Doc
plamexp bs (Lam b e) = plamexp (bs ++ [b]) e
plamexp bs e = sep [sep (map pbind bs) <+> text "->",
- indent (pexp e)]
+ indent (pexp e)]
pbind :: Bind -> Doc
pbind (Tb tb) = char '@' <+> ptbind tb
@@ -171,13 +170,13 @@ pappexp (App e1 e2) as = pappexp e1 (Left e2:as)
pappexp (Appt e t) as = pappexp e (Right t:as)
pappexp e as = fsep (paexp e : map pa as)
where pa (Left e) = paexp e
- pa (Right t) = char '@' <+> paty t
+ pa (Right t) = char '@' <+> paty t
pexp (Lam b e) = char '\\' <+> plamexp [b] e
pexp (Let vd e) = (text "%let" <+> pvdefg vd) $$ (text "%in" <+> pexp e)
pexp (Case e vb ty alts) = sep [text "%case" <+> paty ty <+> paexp e,
- text "%of" <+> pvbind vb]
- $$ (indent (braces (vcat (punctuate (char ';') (map palt alts)))))
+ text "%of" <+> pvbind vb]
+ $$ (indent (braces (vcat (punctuate (char ';') (map palt alts)))))
pexp (Cast e co) = (text "%cast" <+> parens (pexp e)) $$ paty co
pexp (Tick s e) = (text "%source" <+> pstring s) $$ pexp e
pexp (External n cc t) = (text "%external" <+> text cc <+> pstring n) $$ paty t
@@ -190,16 +189,16 @@ pvbind (x,t) = parens(pname x <> text "::" <> pty t)
palt :: Alt -> Doc
palt (Acon c tbs vbs e) =
- sep [pqname c,
- sep (map pattbind tbs),
- sep (map pvbind vbs) <+> text "->"]
+ sep [pqname c,
+ sep (map pattbind tbs),
+ sep (map pvbind vbs) <+> text "->"]
$$ indent (pexp e)
palt (Alit l e) =
- (plit l <+> text "->")
- $$ indent (pexp e)
+ (plit l <+> text "->")
+ $$ indent (pexp e)
palt (Adefault e) =
- (text "%_ ->")
- $$ indent (pexp e)
+ (text "%_ ->")
+ $$ indent (pexp e)
plit :: Lit -> Doc
plit (Lint i t) = parens (integer i <> text "::" <> pty t)
@@ -221,16 +220,16 @@ escape :: String -> String
escape s = foldr f [] (map ord s)
where
f cv rest
- | cv > 0xFF = '\\':'x':hs ++ rest
- | (cv < 0x20 || cv > 0x7e || cv == 0x22 || cv == 0x27 || cv == 0x5c) =
- '\\':'x':h1:h0:rest
+ | cv > 0xFF = '\\':'x':hs ++ rest
+ | (cv < 0x20 || cv > 0x7e || cv == 0x22 || cv == 0x27 || cv == 0x5c) =
+ '\\':'x':h1:h0:rest
where (q1,r1) = quotRem cv 16
- h1 = intToDigit q1
+ h1 = intToDigit q1
h0 = intToDigit r1
- hs = dropWhile (=='0') $ reverse $ mkHex cv
- mkHex 0 = ""
- mkHex cv = intToDigit r : mkHex q
- where (q,r) = quotRem cv 16
+ hs = dropWhile (=='0') $ reverse $ mkHex cv
+ mkHex 0 = ""
+ mkHex cv = intToDigit r : mkHex q
+ where (q,r) = quotRem cv 16
f cv rest = (chr cv):rest
\end{code}