summaryrefslogtreecommitdiff
path: root/compiler/GHC/Core/Ppr.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-01-12 19:30:55 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-01-22 15:02:45 -0500
commit957b53760e50d072accc17c77948f18a10a4bb53 (patch)
tree5099bcc355fc9a5047e5dac697511259f688e155 /compiler/GHC/Core/Ppr.hs
parent887eb6ec23eed243604f71c025d280c0b854f4c4 (diff)
downloadhaskell-957b53760e50d072accc17c77948f18a10a4bb53.tar.gz
Core: introduce Alt/AnnAlt/IfaceAlt datatypes
Alt, AnnAlt and IfaceAlt were using triples. This patch makes them use dedicated types so that we can try to make some fields strict (for example) in the future.
Diffstat (limited to 'compiler/GHC/Core/Ppr.hs')
-rw-r--r--compiler/GHC/Core/Ppr.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/GHC/Core/Ppr.hs b/compiler/GHC/Core/Ppr.hs
index 37e5afc963..ddfa2ea2a6 100644
--- a/compiler/GHC/Core/Ppr.hs
+++ b/compiler/GHC/Core/Ppr.hs
@@ -68,6 +68,9 @@ instance OutputableBndr b => Outputable (Bind b) where
instance OutputableBndr b => Outputable (Expr b) where
ppr expr = pprCoreExpr expr
+instance OutputableBndr b => Outputable (Alt b) where
+ ppr expr = pprCoreAlt expr
+
{-
************************************************************************
* *
@@ -221,7 +224,7 @@ ppr_expr add_par expr@(App {})
_ -> parens (hang (pprParendExpr fun) 2 pp_args)
}
-ppr_expr add_par (Case expr var ty [(con,args,rhs)])
+ppr_expr add_par (Case expr var ty [Alt con args rhs])
= sdocOption sdocPrintCaseAsLet $ \case
True -> add_par $ -- See Note [Print case as let]
sep [ sep [ text "let! {"
@@ -299,8 +302,8 @@ ppr_expr add_par (Tick tickish expr)
True -> ppr_expr add_par expr
False -> add_par (sep [ppr tickish, pprCoreExpr expr])
-pprCoreAlt :: OutputableBndr a => (AltCon, [a] , Expr a) -> SDoc
-pprCoreAlt (con, args, rhs)
+pprCoreAlt :: OutputableBndr a => Alt a -> SDoc
+pprCoreAlt (Alt con args rhs)
= hang (ppr_case_pat con args <+> arrow) 2 (pprCoreExpr rhs)
ppr_case_pat :: OutputableBndr a => AltCon -> [a] -> SDoc