summaryrefslogtreecommitdiff
path: root/compiler/main/PprTyThing.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2012-12-19 10:28:34 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2012-12-19 10:32:01 +0000
commitb5853125ca6a5637647d0b0f2d6271cbf219b337 (patch)
tree3a9d16e1a9db52366cdb03205ce56cb285b1917b /compiler/main/PprTyThing.hs
parentea8490e79d37ba758d5ffcf19b087cf74e09b5a0 (diff)
downloadhaskell-b5853125ca6a5637647d0b0f2d6271cbf219b337.tar.gz
Wibbles to faa8ff40 (UNPACK pragmas)
Nothing big here, just tidying up deetails
Diffstat (limited to 'compiler/main/PprTyThing.hs')
-rw-r--r--compiler/main/PprTyThing.hs24
1 files changed, 20 insertions, 4 deletions
diff --git a/compiler/main/PprTyThing.hs b/compiler/main/PprTyThing.hs
index 0fa7bdff52..81d8e506c6 100644
--- a/compiler/main/PprTyThing.hs
+++ b/compiler/main/PprTyThing.hs
@@ -29,10 +29,12 @@ import GHC ( TyThing(..) )
import DataCon
import Id
import TyCon
+import BasicTypes
import Coercion( pprCoAxiom )
import HscTypes( tyThingParent_maybe )
import TcType
import Name
+import StaticFlags( opt_PprStyle_Debug )
import Outputable
import FastString
@@ -203,7 +205,7 @@ pprDataConDecl pefas ss gadt_style dataCon
(arg_tys, res_ty) = tcSplitFunTys tau
labels = GHC.dataConFieldLabels dataCon
stricts = GHC.dataConStrictMarks dataCon
- tys_w_strs = zip stricts arg_tys
+ tys_w_strs = zip (map user_ify stricts) arg_tys
pp_foralls | pefas = GHC.pprForAll forall_tvs
| otherwise = empty
@@ -211,11 +213,17 @@ pprDataConDecl pefas ss gadt_style dataCon
add str_ty pp_ty = pprParendBangTy str_ty <+> arrow <+> pp_ty
pprParendBangTy (bang,ty) = ppr bang <> GHC.pprParendType ty
+ pprBangTy (bang,ty) = ppr bang <> ppr ty
- pprBangTy bang ty = ppr bang <> ppr ty
+ -- See Note [Printing bangs on data constructors]
+ user_ify :: HsBang -> HsBang
+ user_ify bang | opt_PprStyle_Debug = bang
+ user_ify HsStrict = HsBang False
+ user_ify HsUnpack = HsBang True
+ user_ify bang = bang
- maybe_show_label (lbl,(strict,tp))
- | showSub ss lbl = Just (ppr lbl <+> dcolon <+> pprBangTy strict tp)
+ maybe_show_label (lbl,bty)
+ | showSub ss lbl = Just (ppr lbl <+> dcolon <+> pprBangTy bty)
| otherwise = Nothing
ppr_fields [ty1, ty2]
@@ -290,3 +298,11 @@ showWithLoc loc doc
where
comment = ptext (sLit "--")
+{-
+Note [Printing bangs on data constructors]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+For imported data constructors the dataConStrictMarks are the
+representation choices (see Note [Bangs on data constructor arguments]
+in DataCon.lhs). So we have to fiddle a little bit here to turn them
+back into user-printable form.
+-}