Commit 790cd00d authored by mnislaih's avatar mnislaih
Browse files

Reorganizing my mess a bit

parent 67dbed85
......@@ -114,9 +114,6 @@ debug_enabled = do
debug_enabled = return False
#endif
maybeInsertBreakpoint :: LHsExpr Id -> Type -> DsM (LHsExpr Id)
--maybeInsertBreakpoint e | pprTrace("insertBreakpoint at" (ppr e) False = undefined
isInstrumentationSpot (L loc e) = do
ghcmode <- getGhcModeDs
instrumenting <- debug_enabled
......@@ -144,7 +141,6 @@ dynBreakpoint loc = do
-- Records a breakpoint site and returns the site number
recordBkpt :: SrcLoc -> DsM (Int)
--recordBkpt | trace "recordBkpt" False = undefined
recordBkpt loc = do
sites_var <- getBkptSitesDs
sites <- ioToIOEnv$ readIORef sites_var
......@@ -180,13 +176,14 @@ mkJumpFunc bkptFuncId
breakpoints_enabled :: DsM Bool
dsAndThenMaybeInsertBreakpoint :: LHsExpr Id -> DsM CoreExpr
-- | Takes an expression and its type
maybeInsertBreakpoint :: LHsExpr Id -> Type -> DsM (LHsExpr Id)
#ifdef GHCI
maybeInsertBreakpoint lhsexpr@(L loc _) ty = do
instrumenting <- isInstrumentationSpot lhsexpr
if instrumenting
then do L _ dynBkpt <- dynBreakpoint loc
-- return (l (HsApp (l$ TyApp dynBkpt [ty]) lhsexpr))
return$ l(HsApp (l$ HsWrap (WpTyApp ty) dynBkpt) lhsexpr)
else return lhsexpr
where l = L loc
......
......@@ -61,7 +61,6 @@ import Name
import VarEnv
import OccName
import VarSet
import Unique
import {-#SOURCE#-} TcRnDriver ( tcRnRecoverDataCon )
import TysPrim
......@@ -125,6 +124,11 @@ isPrim _ = False
termType t@(Suspension {}) = mb_ty t
termType t = Just$ ty t
isFullyEvaluatedTerm :: Term -> Bool
isFullyEvaluatedTerm Term {subTerms=tt} = all isFullyEvaluatedTerm tt
isFullyEvaluatedTerm Suspension {} = False
isFullyEvaluatedTerm Prim {} = True
instance Outputable (Term) where
ppr = head . customPrintTerm customPrintTermBase
......@@ -358,7 +362,7 @@ customPrintTermBase showP =
, largeIntegerDataConName]
isTupleDC Term{dc=dc} = dc `elem` snd (unzip (elems boxedTupleArr))
isDC a_dc Term{dc=dc} = a_dc == dc
coerceShow f Term{val=val} = return . text . show . f . unsafeCoerce# $ val
coerceShow f = return . text . show . f . unsafeCoerce# . val
--TODO pprinting of list terms is not lazy
doList h t = do
let elems = h : getListTerms t
......@@ -379,12 +383,6 @@ customPrintTermBase showP =
getListTerms t@Suspension{} = [t]
getListTerms t = pprPanic "getListTerms" (ppr t)
isFullyEvaluatedTerm :: Term -> Bool
isFullyEvaluatedTerm Term {subTerms=tt} = all isFullyEvaluatedTerm tt
isFullyEvaluatedTerm Suspension {} = False
isFullyEvaluatedTerm Prim {} = True
-----------------------------------
-- Type Reconstruction
-----------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment