RtClosureInspect

ghc-8.6.1: The GHC API

Safe Haskell | None
Language | Haskell2010

RtClosureInspect

Synopsis

- cvObtainTerm :: HscEnv -> Int -> Bool -> RttiType -> HValue -> IO Term
- cvReconstructType :: HscEnv -> Int -> GhciType -> HValue -> IO (Maybe Type)
- improveRTTIType :: HscEnv -> RttiType -> RttiType -> Maybe TCvSubst
- data Term
  - = Term {
    - ty :: RttiType
    - dc :: Either String DataCon
    - val :: HValue
    - subTerms :: [Term]
    }
  - | Prim {
    - ty :: RttiType
    - valRaw :: [Word]
    }
  - | Suspension {
    - ctype :: ClosureType
    - ty :: RttiType
    - val :: HValue
    - bound_to :: Maybe Name
    }
  - | NewtypeWrap {
    - ty :: RttiType
    - dc :: Either String DataCon
    - wrapped_term :: Term
    }
  - | RefWrap {
    - ty :: RttiType
    - wrapped_term :: Term
    }
- isTerm :: Term -> Bool
- isSuspension :: Term -> Bool
- isPrim :: Term -> Bool
- isFun :: Term -> Bool
- isFunLike :: Term -> Bool
- isNewtypeWrap :: Term -> Bool
- isFullyEvaluated :: a -> IO Bool
- 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 -> HValue -> Maybe Name -> a
  - fNewtypeWrap :: RttiType -> Either String DataCon -> a -> a
  - fRefWrap :: RttiType -> a -> a
  }
- foldTermM :: Monad m => TermFoldM m a -> Term -> m a
- data TermFoldM m a = TermFoldM {
  - fTermM :: TermProcessor a (m a)
  - fPrimM :: RttiType -> [Word] -> m a
  - fSuspensionM :: ClosureType -> RttiType -> HValue -> Maybe Name -> m a
  - fNewtypeWrapM :: RttiType -> Either String DataCon -> a -> m a
  - fRefWrapM :: RttiType -> a -> m a
  }
- idTermFold :: TermFold Term
- pprTerm :: TermPrinter -> TermPrinter
- cPprTerm :: Monad m => CustomTermPrinter m -> Term -> m SDoc
- cPprTermBase :: forall m. Monad m => CustomTermPrinter m
- type CustomTermPrinter m = TermPrinterM m -> [Precedence -> Term -> m (Maybe SDoc)]
- constrClosToName :: HscEnv -> Closure -> IO (Either String Name)
- isConstr :: GenClosure a -> Bool
- isIndirection :: GenClosure a -> Bool

# Documentation

cvObtainTerm :: HscEnv -> Int -> Bool -> RttiType -> HValue -> IO Term Source #

cvReconstructType :: HscEnv -> Int -> GhciType -> HValue -> IO (Maybe Type) Source #

improveRTTIType :: HscEnv -> RttiType -> RttiType -> Maybe TCvSubst Source #

data Term Source #

Constructors

Term |
Fields ty :: RttiType dc :: Either String DataCon val :: HValue subTerms :: [Term]
Prim |
Fields ty :: RttiType valRaw :: [Word]
Suspension |
Fields ctype :: ClosureType ty :: RttiType val :: HValue bound_to :: Maybe Name
NewtypeWrap |
Fields ty :: RttiType dc :: Either String DataCon wrapped_term :: Term
RefWrap |
Fields ty :: RttiType wrapped_term :: Term

Instances

Outputable Term # |
Instance details Defined in RtClosureInspect Methods ppr :: Term -> SDoc Source # pprPrec :: Rational -> Term -> SDoc Source #

isTerm :: Term -> Bool Source #

isSuspension :: Term -> Bool Source #

isPrim :: Term -> Bool Source #

isFun :: Term -> Bool Source #

isFunLike :: Term -> Bool Source #

isNewtypeWrap :: Term -> Bool Source #

isFullyEvaluated :: a -> IO Bool Source #

isFullyEvaluatedTerm :: Term -> Bool Source #

termType :: Term -> RttiType Source #

mapTermType :: (RttiType -> Type) -> Term -> Term Source #

termTyCoVars :: Term -> TyCoVarSet Source #

foldTerm :: TermFold a -> Term -> a Source #

data TermFold a Source #

Constructors

TermFold |
Fields fTerm :: TermProcessor a a fPrim :: RttiType -> [Word] -> a fSuspension :: ClosureType -> RttiType -> HValue -> Maybe Name -> a fNewtypeWrap :: RttiType -> Either String DataCon -> a -> a fRefWrap :: RttiType -> a -> a

foldTermM :: Monad m => TermFoldM m a -> Term -> m a Source #

data TermFoldM m a Source #

Constructors

TermFoldM |
Fields fTermM :: TermProcessor a (m a) fPrimM :: RttiType -> [Word] -> m a fSuspensionM :: ClosureType -> RttiType -> HValue -> Maybe Name -> m a fNewtypeWrapM :: RttiType -> Either String DataCon -> a -> m a fRefWrapM :: RttiType -> a -> m a

idTermFold :: TermFold Term Source #

pprTerm :: TermPrinter -> TermPrinter Source #

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 #

type CustomTermPrinter m = TermPrinterM m -> [Precedence -> Term -> m (Maybe SDoc)] Source #

constrClosToName :: HscEnv -> Closure -> IO (Either String Name) Source #

isConstr :: GenClosure a -> Bool Source #

isIndirection :: GenClosure a -> Bool Source #