)
import Literal ( Literal(..) )
import Maybes ( maybeToBool )
-import PrelInfo ( maybeCharLikeTyCon, maybeIntLikeTyCon )
+import PrelInfo ( maybeCharLikeCon, maybeIntLikeCon )
import PrimRep ( isFloatingRep, PrimRep(..) )
import TyCon ( TyCon{-instance Uniquable-} )
import Util ( isIn, zipWithEqual, panic, assertPanic )
\begin{code}
buildDynCon binder cc con [arg_amode] all_zero_size_args@False
- | maybeToBool (maybeCharLikeTyCon tycon)
+ | maybeCharLikeCon con
= ASSERT(isDataCon con)
absC (CAssign temp_amode (CCharLike arg_amode)) `thenC`
returnFC temp_id_info
- | maybeToBool (maybeIntLikeTyCon tycon) && in_range_int_lit arg_amode
+ | maybeIntLikeCon con && in_range_int_lit arg_amode
= ASSERT(isDataCon con)
returnFC (stableAmodeIdInfo binder (CIntLike arg_amode) (mkConLFInfo con))
where
- tycon = dataConTyCon con
(temp_amode, temp_id_info) = newTempAmodeAndIdInfo binder (mkConLFInfo con)
in_range_int_lit (CLit (MachInt val _)) = val <= mAX_INTLIKE && val >= mIN_INTLIKE
GenId{-instance NamedThing-}, Id
)
import Name ( getOccString )
-import PrelInfo ( maybeIntLikeTyCon )
import PrimRep ( getPrimRepSize, PrimRep(..) )
import TyCon ( tyConDataCons, mkSpecTyCon, TyCon )
import Type ( typePrimRep, Type )
import Maybes ( maybeToBool )
import Name ( getOccString )
import PprType ( getTyDescription )
-import PrelInfo ( maybeCharLikeTyCon, maybeIntLikeTyCon )
+import PrelInfo ( maybeCharLikeCon, maybeIntLikeCon )
import PrimRep ( getPrimRepSize, separateByPtrFollowness, PrimRep )
import SMRep -- all of it
import TyCon ( TyCon, isNewTyCon )
(LFCon _ True) -> ConstantRep
- (LFCon con _ ) -> if maybeToBool (maybeCharLikeTyCon tycon) then CharLikeRep
- else if maybeToBool (maybeIntLikeTyCon tycon) then IntLikeRep
+ (LFCon con _ ) -> if maybeCharLikeCon con then CharLikeRep
+ else if maybeIntLikeCon con then IntLikeRep
else SpecRep
- where
- tycon = dataConTyCon con
_ -> SpecRep
in
builtinNames, derivingOccurrences,
BuiltinNames,
- maybeCharLikeTyCon, maybeIntLikeTyCon,
+ maybeCharLikeCon, maybeIntLikeCon,
eq_RDR, ne_RDR, le_RDR, lt_RDR, ge_RDR, gt_RDR, max_RDR, min_RDR,
compare_RDR, minBound_RDR, maxBound_RDR, enumFrom_RDR, enumFromTo_RDR,
ToDo: make it do the ``like'' part properly (as in 0.26 and before).
\begin{code}
-maybeCharLikeTyCon tc = if (uniqueOf tc == charDataConKey) then Just charDataCon else Nothing
-maybeIntLikeTyCon tc = if (uniqueOf tc == intDataConKey) then Just intDataCon else Nothing
+maybeCharLikeCon, maybeIntLikeCon :: Id -> Bool
+maybeCharLikeCon con = uniqueOf con == charDataConKey
+maybeIntLikeCon con = uniqueOf con == intDataConKey
\end{code}
%************************************************************************