projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d139f68
)
Fix Trac #2138: print the 'stupid theta' of a data type
author
simonpj@microsoft.com
<unknown>
Thu, 6 Mar 2008 13:46:51 +0000
(13:46 +0000)
committer
simonpj@microsoft.com
<unknown>
Thu, 6 Mar 2008 13:46:51 +0000
(13:46 +0000)
compiler/main/PprTyThing.hs
patch
|
blob
|
history
diff --git
a/compiler/main/PprTyThing.hs
b/compiler/main/PprTyThing.hs
index
2a7abb4
..
c379d97
100644
(file)
--- a/
compiler/main/PprTyThing.hs
+++ b/
compiler/main/PprTyThing.hs
@@
-28,7
+28,7
@@
module PprTyThing (
import qualified GHC
import GHC ( TyThing(..) )
import qualified GHC
import GHC ( TyThing(..) )
-import TyCon ( tyConFamInst_maybe )
+import TyCon ( tyConFamInst_maybe, isAlgTyCon, tyConStupidTheta )
import Type ( TyThing(..), tidyTopType, pprTypeApp )
import TcType ( tcMultiSplitSigmaTy, mkPhiTy )
import SrcLoc ( SrcSpan )
import Type ( TyThing(..), tidyTopType, pprTypeApp )
import TcType ( tcMultiSplitSigmaTy, mkPhiTy )
import SrcLoc ( SrcSpan )
@@
-86,7
+86,7
@@
pprTyConHdr pefas tyCon
| Just (fam_tc, tys) <- tyConFamInst_maybe tyCon
= ptext keyword <+> ptext SLIT("instance") <+> pprTypeApp tyCon (ppr_bndr tyCon) tys
| otherwise
| Just (fam_tc, tys) <- tyConFamInst_maybe tyCon
= ptext keyword <+> ptext SLIT("instance") <+> pprTypeApp tyCon (ppr_bndr tyCon) tys
| otherwise
- = ptext keyword <+> opt_family <+> ppr_bndr tyCon <+> hsep (map ppr vars)
+ = ptext keyword <+> opt_family <+> opt_stupid <+> ppr_bndr tyCon <+> hsep (map ppr vars)
where
vars | GHC.isPrimTyCon tyCon ||
GHC.isFunTyCon tyCon = take (GHC.tyConArity tyCon) GHC.alphaTyVars
where
vars | GHC.isPrimTyCon tyCon ||
GHC.isFunTyCon tyCon = take (GHC.tyConArity tyCon) GHC.alphaTyVars
@@
-100,6
+100,10
@@
pprTyConHdr pefas tyCon
| GHC.isOpenTyCon tyCon = ptext SLIT("family")
| otherwise = empty
| GHC.isOpenTyCon tyCon = ptext SLIT("family")
| otherwise = empty
+ opt_stupid -- The "stupid theta" part of the declaration
+ | isAlgTyCon tyCon = GHC.pprThetaArrow (tyConStupidTheta tyCon)
+ | otherwise = empty -- Returns 'empty' if null theta
+
pprDataConSig pefas dataCon =
ppr_bndr dataCon <+> dcolon <+> pprTypeForUser pefas (GHC.dataConType dataCon)
pprDataConSig pefas dataCon =
ppr_bndr dataCon <+> dcolon <+> pprTypeForUser pefas (GHC.dataConType dataCon)