summaryrefslogtreecommitdiff
path: root/compiler/ghci
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2009-07-22 15:10:48 +0000
committerIan Lynagh <igloo@earth.li>2009-07-22 15:10:48 +0000
commit30a08433b46de89511fcdf0149f0749739227efb (patch)
tree119a8246c117b2e6ac186c38861aee5f8ec63767 /compiler/ghci
parent51984e25deeba8a8abbab00d89cca51f3fd051b0 (diff)
downloadhaskell-30a08433b46de89511fcdf0149f0749739227efb.tar.gz
Make the Integer library used directly configurable in GHC and base
Rather than indirecting through an integer package
Diffstat (limited to 'compiler/ghci')
-rw-r--r--compiler/ghci/RtClosureInspect.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/ghci/RtClosureInspect.hs b/compiler/ghci/RtClosureInspect.hs
index 76ef9be1f7..cc16047616 100644
--- a/compiler/ghci/RtClosureInspect.hs
+++ b/compiler/ghci/RtClosureInspect.hs
@@ -385,10 +385,8 @@ pprNewtypeWrap y p NewtypeWrap{ty=ty, wrapped_term=t}
| Just (tc,_) <- tcSplitTyConApp_maybe ty
, ASSERT(isNewTyCon tc) True
, Just new_dc <- tyConSingleDataCon_maybe tc = do
- if integerDataConName == dataConName new_dc
- then return $ text $ show $ (unsafeCoerce# $ val t :: Integer)
- else do real_term <- y max_prec t
- return$ cparen (p >= app_prec) (ppr new_dc <+> real_term)
+ real_term <- y max_prec t
+ return $ cparen (p >= app_prec) (ppr new_dc <+> real_term)
pprNewtypeWrap _ _ _ = panic "pprNewtypeWrap"
-------------------------------------------------------
@@ -433,6 +431,7 @@ cPprTermBase y =
, ifTerm (isTyCon charTyCon . ty) (coerceShow$ \(a::Char)->a)
, ifTerm (isTyCon floatTyCon . ty) (coerceShow$ \(a::Float)->a)
, ifTerm (isTyCon doubleTyCon . ty) (coerceShow$ \(a::Double)->a)
+ , ifTerm (isIntegerTy . ty) (coerceShow$ \(a::Integer)->a)
]
where ifTerm pred f prec t@Term{}
| pred t = Just `liftM` f prec t
@@ -446,6 +445,10 @@ cPprTermBase y =
(tc,_) <- tcSplitTyConApp_maybe ty
return (a_tc == tc)
+ isIntegerTy ty = fromMaybe False $ do
+ (tc,_) <- tcSplitTyConApp_maybe ty
+ return (tyConName tc == integerTyConName)
+
coerceShow f _p = return . text . show . f . unsafeCoerce# . val
--Note pprinting of list terms is not lazy