module Const (
Con(..),
conType, conPrimRep,
- conOkForApp, conOkForAlt, isWHNFCon, isDataCon,
+ conOkForApp, conOkForAlt, isWHNFCon, isDataCon, isBoxedDataCon,
conIsTrivial, conIsCheap, conIsDupable, conStrictness,
conOkForSpeculation, hashCon,
import PrimOp ( PrimOp, primOpType, primOpIsDupable, primOpTag,
primOpIsCheap, primOpStrictness, primOpOkForSpeculation )
import PrimRep ( PrimRep(..) )
-import DataCon ( DataCon, dataConName, dataConType, dataConTyCon, isNullaryDataCon, dataConRepStrictness )
+import DataCon ( DataCon, dataConName, dataConType, dataConTyCon,
+ isNullaryDataCon, dataConRepStrictness, isUnboxedTupleCon
+ )
import TyCon ( isNewTyCon )
import Type ( Type, typePrimRep )
import PprType ( pprParendType )
import Ratio ( numerator, denominator )
import FastString ( uniqueOfFS )
import Char ( ord )
+
+#if __GLASGOW_HASKELL__ >= 404
+import GlaExts ( fromInt )
+#endif
\end{code}
isDataCon (DataCon dc) = True
isDataCon other = False
+isBoxedDataCon (DataCon dc) = not (isUnboxedTupleCon dc)
+isBoxedDataCon other = False
+
-- conIsTrivial is true for constants we are unconditionally happy to duplicate
-- cf CoreUtils.exprIsTrivial
conIsTrivial (Literal lit) = not (isNoRepLit lit)
<+> ppr range_max)])
-- in interface files, parenthesize raw negative ints.
-- this avoids problems like {-1} being interpreted
- -- as a comment starter.
+ -- as a comment starter. -}
| ifaceStyle sty && i < 0 -> parens (integer i)
+ -- avoid a problem whereby gcc interprets the constant
+ -- minInt as unsigned.
+ | code_style && i == (toInteger (minBound :: Int))
+ -> parens (hcat [integer (i+1), text "-1"])
| otherwise -> integer i
where