Safe Haskell | None |
---|---|
Language | Haskell2010 |
An interpreter operating on type-checked source Futhark terms. Relatively slow.
Synopsis
- data Ctx = Ctx {}
- data Env
- data InterpreterError
- initialCtx :: Ctx
- interpretExp :: Ctx -> Exp -> F ExtOp Value
- interpretDec :: Ctx -> Dec -> F ExtOp Ctx
- interpretImport :: Ctx -> (FilePath, Prog) -> F ExtOp Ctx
- interpretFunction :: Ctx -> VName -> [Value] -> Either String (F ExtOp Value)
- data ExtOp a
- data BreakReason
- data StackFrame = StackFrame {
- stackFrameLoc :: Loc
- stackFrameCtx :: Ctx
- typeCheckerEnv :: Env -> Env
- data Value
- = ValuePrim !PrimValue
- | ValueArray ValueShape !(Array Int Value)
- | ValueRecord (Map Name Value)
- fromTuple :: Value -> Maybe [Value]
- isEmptyArray :: Value -> Bool
- prettyEmptyArray :: TypeBase () () -> Value -> String
Documentation
The interpreter context. All evaluation takes place with respect to a context, and it can be extended with more definitions, which is how the REPL works.
The actual type- and value environment.
Instances
data InterpreterError Source #
An error occurred during interpretation due to an error in the
user program. Actual interpreter errors will be signaled with an
IO exception (error
).
Instances
Show InterpreterError Source # | |
Defined in Language.Futhark.Interpreter showsPrec :: Int -> InterpreterError -> ShowS # show :: InterpreterError -> String # showList :: [InterpreterError] -> ShowS # |
initialCtx :: Ctx Source #
The initial environment contains definitions of the various intrinsic functions.
interpretFunction :: Ctx -> VName -> [Value] -> Either String (F ExtOp Value) Source #
Execute the named function on the given arguments; may fail horribly if these are ill-typed.
data BreakReason Source #
What is the reason for this break point?
BreakPoint | An explicit breakpoint in the program. |
BreakNaN | A |
data StackFrame Source #
Instances
Located StackFrame Source # | |
Defined in Language.Futhark.Interpreter locOf :: StackFrame -> Loc # locOfList :: [StackFrame] -> Loc # |
typeCheckerEnv :: Env -> Env Source #
A fully evaluated Futhark value.
ValuePrim !PrimValue | |
ValueArray ValueShape !(Array Int Value) | |
ValueRecord (Map Name Value) |
isEmptyArray :: Value -> Bool Source #
Does the value correspond to an empty array?