| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
RtClosureInspect
Contents
Synopsis
- cvObtainTerm :: HscEnv -> Int -> Bool -> RttiType -> ForeignHValue -> IO Term
- cvReconstructType :: HscEnv -> Int -> GhciType -> ForeignHValue -> IO (Maybe Type)
- improveRTTIType :: HscEnv -> RttiType -> RttiType -> Maybe TCvSubst
- data Term
- = Term { }
- | Prim { }
- | Suspension {
- ctype :: ClosureType
- ty :: RttiType
- val :: ForeignHValue
- bound_to :: Maybe Name
- | NewtypeWrap { }
- | RefWrap {
- ty :: RttiType
- wrapped_term :: Term
- isFullyEvaluatedTerm :: Term -> Bool
- termType :: Term -> RttiType
- mapTermType :: (RttiType -> Type) -> Term -> Term
- termTyCoVars :: Term -> TyCoVarSet
- foldTerm :: TermFold a -> Term -> a
- data TermFold a = TermFold {
- fTerm :: TermProcessor a a
- fPrim :: RttiType -> [Word] -> a
- fSuspension :: ClosureType -> RttiType -> ForeignHValue -> Maybe Name -> a
- fNewtypeWrap :: RttiType -> Either String DataCon -> a -> a
- fRefWrap :: RttiType -> a -> a
- cPprTerm :: Monad m => CustomTermPrinter m -> Term -> m SDoc
- cPprTermBase :: forall m. Monad m => CustomTermPrinter m
- constrClosToName :: HscEnv -> GenClosure a -> IO (Either String Name)
Entry points and types
Arguments
How many times to recurse for subterms
Force thunks
Type of the object to reconstruct
Object to reconstruct
Term reconstruction
Given a pointer to a heap object (HValue ) and its type, build a Term
representation of the object. Subterms (objects in the payload) are also
built up to the given max_depth. After max_depth any subterms will appear
as Suspension s. Any thunks found while traversing the object will be forced
based on force parameter.
Types of terms will be refined based on constructors we find during term
reconstruction. See cvReconstructType for an overview of how type
reconstruction works.
Arguments
How many times to recurse for subterms
Type to refine
Refine the type using this value
Fast, breadth-first Type reconstruction
Given a heap object (HValue ) and its (possibly polymorphic) type (usually
obtained in GHCi), try to reconstruct a more monomorphic type of the object.
This is used for improving type information in debugger. For example, if we
have a polymorphic function:
sumNumList :: Num a => [a] -> a sumNumList [] = 0 sumNumList (x : xs) = x + sumList xs
and add a breakpoint to it:
ghci> break sumNumList ghci> sumNumList ([0 .. 9] :: [Int])
ghci shows us more precise types than just as:
Stopped in Main.sumNumList, debugger.hs:3:23-39 _result :: Int = _ x :: Int = 0 xs :: [Int] = _
Constructors
Fields
- ctype :: ClosureType
- ty :: RttiType
- val :: ForeignHValue
- bound_to :: Maybe Name
Fields
- ty :: RttiType
- wrapped_term :: Term
Utils
isFullyEvaluatedTerm :: Term -> Bool Source #
termTyCoVars :: Term -> TyCoVarSet Source #
Constructors
Fields
- fTerm :: TermProcessor a a
- fPrim :: RttiType -> [Word] -> a
- fSuspension :: ClosureType -> RttiType -> ForeignHValue -> Maybe Name -> a
- fNewtypeWrap :: RttiType -> Either String DataCon -> a -> a
- fRefWrap :: RttiType -> a -> a
cPprTerm :: Monad m => CustomTermPrinter m -> Term -> m SDoc Source #
Takes a list of custom printers with a explicit recursion knot and a term, and returns the output of the first successful printer, or the default printer
cPprTermBase :: forall m. Monad m => CustomTermPrinter m Source #
constrClosToName :: HscEnv -> GenClosure a -> IO (Either String Name) Source #