futhark-0.25.24: An optimising compiler for a functional, array-oriented language.
Safe HaskellSafe-Inferred
LanguageGHC2021

Language.Futhark.Interpreter

Contents

Description

An interpreter operating on type-checked source Futhark terms. Relatively slow.

Synopsis

Documentation

data Ctx Source #

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.

Constructors

Ctx 

data Env Source #

The actual type- and value environment.

Instances

Instances details
Monoid Env Source # 
Instance details

Defined in Language.Futhark.Interpreter

Methods

mempty :: Env #

mappend :: Env -> Env -> Env #

mconcat :: [Env] -> Env #

Semigroup Env Source # 
Instance details

Defined in Language.Futhark.Interpreter

Methods

(<>) :: Env -> Env -> Env #

sconcat :: NonEmpty Env -> Env #

stimes :: Integral b => b -> Env -> Env #

Show Env Source # 
Instance details

Defined in Language.Futhark.Interpreter

Methods

showsPrec :: Int -> Env -> ShowS #

show :: Env -> String #

showList :: [Env] -> ShowS #

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

Instances details
Show InterpreterError Source # 
Instance details

Defined in Language.Futhark.Interpreter

prettyInterpreterError :: InterpreterError -> Doc AnsiStyle Source #

Prettyprint the error for human consumption.

initialCtx :: Ctx Source #

The initial environment contains definitions of the various intrinsic functions.

interpretFunction :: Ctx -> VName -> [Value] -> Either Text (F ExtOp Value) Source #

Execute the named function on the given arguments; may fail horribly if these are ill-typed.

ctxWithImports :: [Env] -> Ctx -> Ctx Source #

Produce a context, based on the one passed in, where all of the provided imports have been openened in order.

data ExtOp a Source #

Instances

Instances details
Functor ExtOp Source # 
Instance details

Defined in Language.Futhark.Interpreter

Methods

fmap :: (a -> b) -> ExtOp a -> ExtOp b #

(<$) :: a -> ExtOp b -> ExtOp a #

data BreakReason Source #

What is the reason for this break point?

Constructors

BreakPoint

An explicit breakpoint in the program.

BreakNaN

A

data StackFrame Source #

Constructors

StackFrame 

Instances

Instances details
Located StackFrame Source # 
Instance details

Defined in Language.Futhark.Interpreter

Values

type Value = Value EvalM Source #

isEmptyArray :: Value m -> Bool Source #

Does the value correspond to an empty array?

prettyEmptyArray :: TypeBase () () -> Value m -> Text Source #

String representation of an empty array with the provided element type. This is pretty ad-hoc - don't expect good results unless the element type is a primitive.

prettyValue :: Value m -> Doc a Source #

Prettyprint value.

valueText :: Value m -> Text Source #

The value in the textual format.