| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Stg.Marshal.FromStg
Description
Extract Haskell values from running STG programs.
- class FromStg value where
- fromStg :: StgState -> Var -> Either FromStgError value
- fromStgAddr :: StgState -> MemAddr -> Either FromStgError value
- fromStgPrim :: Integer -> Either FromStgError value
- data FromStgError
Documentation
class FromStg value where Source
Look up the value of a global variable.
Instances of this class should have a corresponding ToStg instance to
inject a value into the program, with the two being inverse to each other (up
to forcing the generated thunks).
Minimal complete definition
Methods
Arguments
| :: StgState | |
| -> Var | Name of the global, e.g. |
| -> Either FromStgError value |
Retrieve the value of a global variable.
fromStgAddr :: StgState -> MemAddr -> Either FromStgError value Source
Retrieve the value of a heap address.
fromStgPrim :: Integer -> Either FromStgError value Source
Used only for looking up primitive integers.
Instances
| FromStg Bool Source | |
| FromStg Integer Source | Boxed ( |
| FromStg () Source | |
| FromStg a => FromStg [a] Source | |
| FromStg a => FromStg (Maybe a) Source | |
| (FromStg a, FromStg b) => FromStg (Either a b) Source | |
| (FromStg a, FromStg b) => FromStg (a, b) Source | |
| (FromStg a, FromStg b, FromStg c) => FromStg (a, b, c) Source | |
| (FromStg a, FromStg b, FromStg c, FromStg d) => FromStg (a, b, c, d) Source | |
| (FromStg a, FromStg b, FromStg c, FromStg d, FromStg e) => FromStg (a, b, c, d, e) Source |
data FromStgError Source
Constructors
| TypeMismatch | e.g. asking for an |
| IsWrongLambdaType LambdaType | Tried retrieving a non-constructor |
| IsBlackhole | Tried retrieving a black hole |
| BadArity | e.g. |
| NotFound NotInScope | An unsuccessful variable lookup |
| AddrNotOnHeap | |
| NoConstructorMatch | None of the given alternatives matched the given
constructor, e.g. when trying to receive a |
Instances