futhark-0.20.0: An optimising compiler for a functional, array-oriented language.
Safe HaskellNone
LanguageHaskell2010

Language.Futhark.Interpreter

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
Semigroup Env Source # 
Instance details

Defined in Language.Futhark.Interpreter

Methods

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

sconcat :: NonEmpty Env -> Env #

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

Monoid Env Source # 
Instance details

Defined in Language.Futhark.Interpreter

Methods

mempty :: Env #

mappend :: Env -> Env -> Env #

mconcat :: [Env] -> Env #

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

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 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

data Value Source #

A fully evaluated Futhark value.

Instances

Instances details
Eq Value Source # 
Instance details

Defined in Language.Futhark.Interpreter

Methods

(==) :: Value -> Value -> Bool #

(/=) :: Value -> Value -> Bool #

Pretty Value Source # 
Instance details

Defined in Language.Futhark.Interpreter

Methods

ppr :: Value -> Doc #

pprPrec :: Int -> Value -> Doc #

pprList :: [Value] -> Doc #

isEmptyArray :: Value -> Bool Source #

Does the value correspond to an empty array?

prettyEmptyArray :: TypeBase () () -> Value -> String 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.