summaryrefslogtreecommitdiff
path: root/compiler/GHC/Cmm.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-09-14 19:46:45 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-09-17 20:04:08 -0400
commite45c85446de7589e17acf5654c2b33f766043eb1 (patch)
treedb36adba8d53eb3b9cc8e6cbfd37d43f7c8445b7 /compiler/GHC/Cmm.hs
parentca48076ae866665913b9c81cbc0c76f0afef7a00 (diff)
downloadhaskell-e45c85446de7589e17acf5654c2b33f766043eb1.tar.gz
Generalize OutputableP
Add a type parameter for the environment required by OutputableP. It avoids tying Platform with OutputableP.
Diffstat (limited to 'compiler/GHC/Cmm.hs')
-rw-r--r--compiler/GHC/Cmm.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/GHC/Cmm.hs b/compiler/GHC/Cmm.hs
index a5b3b35b8b..5c4c619b69 100644
--- a/compiler/GHC/Cmm.hs
+++ b/compiler/GHC/Cmm.hs
@@ -4,6 +4,9 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ExplicitNamespaces #-}
{-# LANGUAGE DeriveFunctor #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE FlexibleInstances #-}
+
module GHC.Cmm (
-- * Cmm top-level datatypes
@@ -266,15 +269,15 @@ newtype ListGraph i
instance Outputable instr => Outputable (ListGraph instr) where
ppr (ListGraph blocks) = vcat (map ppr blocks)
-instance OutputableP instr => OutputableP (ListGraph instr) where
- pdoc platform g = ppr (fmap (pdoc platform) g)
+instance OutputableP env instr => OutputableP env (ListGraph instr) where
+ pdoc env g = ppr (fmap (pdoc env) g)
instance Outputable instr => Outputable (GenBasicBlock instr) where
ppr = pprBBlock
-instance OutputableP instr => OutputableP (GenBasicBlock instr) where
- pdoc platform block = ppr (fmap (pdoc platform) block)
+instance OutputableP env instr => OutputableP env (GenBasicBlock instr) where
+ pdoc env block = ppr (fmap (pdoc env) block)
pprBBlock :: Outputable stmt => GenBasicBlock stmt -> SDoc
pprBBlock (BasicBlock ident stmts) =