projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use paragraph fill sep where possible
[ghc-hetmet.git]
/
compiler
/
ghci
/
Debugger.hs
diff --git
a/compiler/ghci/Debugger.hs
b/compiler/ghci/Debugger.hs
index
36c784b
..
9fbee36
100644
(file)
--- a/
compiler/ghci/Debugger.hs
+++ b/
compiler/ghci/Debugger.hs
@@
-25,6
+25,7
@@
import Name
import UniqSupply
import TcType
import GHC
import UniqSupply
import TcType
import GHC
+import DynFlags
import InteractiveEval
import Outputable
import Pretty ( Mode(..), showDocWith )
import InteractiveEval
import Outputable
import Pretty ( Mode(..), showDocWith )
@@
-80,7
+81,7
@@
pprintClosureCommand session bindThings force str = do
-- Then, we extract a substitution,
-- mapping the old tyvars to the reconstructed types.
let Just reconstructed_type = termType term
-- Then, we extract a substitution,
-- mapping the old tyvars to the reconstructed types.
let Just reconstructed_type = termType term
- Just subst = computeRTTIsubst (idType id) (reconstructed_type)
+ subst = computeRTTIsubst (idType id) (reconstructed_type)
return (term',subst)
tidyTermTyVars :: Session -> Term -> IO Term
return (term',subst)
tidyTermTyVars :: Session -> Term -> IO Term
@@
-128,6
+129,10
@@
bindSuspensions cms@(Session ref) t = do
let (terms,names) = unzip tt'
return (Term ty dc v terms, concat names)
, fPrim = \ty n ->return (Prim ty n,[])
let (terms,names) = unzip tt'
return (Term ty dc v terms, concat names)
, fPrim = \ty n ->return (Prim ty n,[])
+ , fNewtypeWrap =
+ \ty dc t -> do
+ (term, names) <- t
+ return (NewtypeWrap ty dc term, names)
}
doSuspension freeNames ct mb_ty hval _name = do
name <- atomicModifyIORef freeNames (\x->(tail x, head x))
}
doSuspension freeNames ct mb_ty hval _name = do
name <- atomicModifyIORef freeNames (\x->(tail x, head x))
@@
-138,11
+143,14
@@
bindSuspensions cms@(Session ref) t = do
-- A custom Term printer to enable the use of Show instances
showTerm :: Session -> Term -> IO SDoc
-- A custom Term printer to enable the use of Show instances
showTerm :: Session -> Term -> IO SDoc
-showTerm cms@(Session ref) = cPprTerm cPpr
+showTerm cms@(Session ref) term = do
+ dflags <- GHC.getSessionDynFlags cms
+ if dopt Opt_PrintEvldWithShow dflags
+ then cPprTerm (liftM2 (++) (\_y->[cPprShowable]) cPprTermBase) term
+ else cPprTerm cPprTermBase term
where
where
- cPpr = \p-> cPprShowable : cPprTermBase p
- cPprShowable prec ty _ val tt =
- if not (all isFullyEvaluatedTerm tt)
+ cPprShowable prec t@Term{ty=ty, val=val} =
+ if not (isFullyEvaluatedTerm t)
then return Nothing
else do
hsc_env <- readIORef ref
then return Nothing
else do
hsc_env <- readIORef ref
@@
-165,6
+173,10
@@
showTerm cms@(Session ref) = cPprTerm cPpr
`finally` do
writeIORef ref hsc_env
GHC.setSessionDynFlags cms dflags
`finally` do
writeIORef ref hsc_env
GHC.setSessionDynFlags cms dflags
+ cPprShowable prec NewtypeWrap{ty=new_ty,wrapped_term=t} =
+ cPprShowable prec t{ty=new_ty}
+ cPprShowable _ _ = panic "cPprShowable - unreachable"
+
needsParens ('"':_) = False -- some simple heuristics to see whether parens
-- are redundant in an arbitrary Show output
needsParens ('(':_) = False
needsParens ('"':_) = False -- some simple heuristics to see whether parens
-- are redundant in an arbitrary Show output
needsParens ('(':_) = False