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

Language.Futhark.Interpreter.Values

Description

The value representation used in the interpreter.

Kept simple and free of unnecessary operational details (in particular, no references to the interpreter monad).

Synopsis

Shapes

data Shape d Source #

A shape is a tree to accomodate the case of records. It is parameterised over the representation of dimensions.

Constructors

ShapeDim d (Shape d) 
ShapeLeaf 
ShapeRecord (Map Name (Shape d)) 
ShapeSum (Map Name [Shape d]) 

Instances

Instances details
Foldable Shape Source # 
Instance details

Defined in Language.Futhark.Interpreter.Values

Methods

fold :: Monoid m => Shape m -> m Source #

foldMap :: Monoid m => (a -> m) -> Shape a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Shape a -> m Source #

foldr :: (a -> b -> b) -> b -> Shape a -> b Source #

foldr' :: (a -> b -> b) -> b -> Shape a -> b Source #

foldl :: (b -> a -> b) -> b -> Shape a -> b Source #

foldl' :: (b -> a -> b) -> b -> Shape a -> b Source #

foldr1 :: (a -> a -> a) -> Shape a -> a Source #

foldl1 :: (a -> a -> a) -> Shape a -> a Source #

toList :: Shape a -> [a] Source #

null :: Shape a -> Bool Source #

length :: Shape a -> Int Source #

elem :: Eq a => a -> Shape a -> Bool Source #

maximum :: Ord a => Shape a -> a Source #

minimum :: Ord a => Shape a -> a Source #

sum :: Num a => Shape a -> a Source #

product :: Num a => Shape a -> a Source #

Traversable Shape Source # 
Instance details

Defined in Language.Futhark.Interpreter.Values

Methods

traverse :: Applicative f => (a -> f b) -> Shape a -> f (Shape b) Source #

sequenceA :: Applicative f => Shape (f a) -> f (Shape a) Source #

mapM :: Monad m => (a -> m b) -> Shape a -> m (Shape b) Source #

sequence :: Monad m => Shape (m a) -> m (Shape a) Source #

Functor Shape Source # 
Instance details

Defined in Language.Futhark.Interpreter.Values

Methods

fmap :: (a -> b) -> Shape a -> Shape b Source #

(<$) :: a -> Shape b -> Shape a Source #

Show d => Show (Shape d) Source # 
Instance details

Defined in Language.Futhark.Interpreter.Values

Eq d => Eq (Shape d) Source # 
Instance details

Defined in Language.Futhark.Interpreter.Values

Methods

(==) :: Shape d -> Shape d -> Bool Source #

(/=) :: Shape d -> Shape d -> Bool Source #

Pretty d => Pretty (Shape d) Source # 
Instance details

Defined in Language.Futhark.Interpreter.Values

Methods

pretty :: Shape d -> Doc ann Source #

prettyList :: [Shape d] -> Doc ann Source #

type ValueShape = Shape Int64 Source #

The shape of an array.

Values

data Value m Source #

A fully evaluated Futhark value.

Instances

Instances details
Show (Value m) Source # 
Instance details

Defined in Language.Futhark.Interpreter.Values

Eq (Value m) Source # 
Instance details

Defined in Language.Futhark.Interpreter.Values

Methods

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

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

prettyValue :: Value m -> Doc a Source #

Prettyprint value.

valueText :: Value m -> Text Source #

The value in the textual format.

arrayLength :: Integral int => Array Int (Value m) -> int 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.

toTuple :: [Value m] -> Value m Source #

Conversion

fromDataValue :: Value -> Value m Source #

Convert a Futhark value in the externally observable data format to an interpreter value.