futhark-0.11.0: An optimising compiler for a functional, array-oriented language.

Safe HaskellNone
LanguageHaskell2010

Futhark.Test.Values

Contents

Description

This module defines an efficient value representation as well as parsing and comparison functions. This is because the standard Futhark parser is not able to cope with large values (like arrays that are tens of megabytes in size). The representation defined here does not support tuples, so don't use those as input/output for your test programs.

Synopsis

Documentation

data Value Source #

An efficiently represented Futhark value. Use pretty to get a human-readable representation, and the instances of Get and Put to obtain binary representations

Constructors

Int8Value (Vector Int) (Vector Int8) 
Int16Value (Vector Int) (Vector Int16) 
Int32Value (Vector Int) (Vector Int32) 
Int64Value (Vector Int) (Vector Int64) 
Word8Value (Vector Int) (Vector Word8) 
Word16Value (Vector Int) (Vector Word16) 
Word32Value (Vector Int) (Vector Word32) 
Word64Value (Vector Int) (Vector Word64) 
Float32Value (Vector Int) (Vector Float) 
Float64Value (Vector Int) (Vector Double) 
BoolValue (Vector Int) (Vector Bool) 
Instances
Show Value Source # 
Instance details

Defined in Futhark.Test.Values

Methods

showsPrec :: Int -> Value -> ShowS #

show :: Value -> String #

showList :: [Value] -> ShowS #

Binary Value Source # 
Instance details

Defined in Futhark.Test.Values

Methods

put :: Value -> Put #

get :: Get Value #

putList :: [Value] -> Put #

Pretty Value Source # 
Instance details

Defined in Futhark.Test.Values

Methods

ppr :: Value -> Doc #

pprPrec :: Int -> Value -> Doc #

pprList :: [Value] -> Doc #

Reading Values

readValues :: ByteString -> Maybe [Value] Source #

Parse Futhark values from the given bytestring.

Types of values

data ValueType Source #

A representation of the simple values we represent in this module.

Constructors

ValueType [Int] PrimType 
Instances
Show ValueType Source # 
Instance details

Defined in Futhark.Test.Values

Pretty ValueType Source # 
Instance details

Defined in Futhark.Test.Values

Methods

ppr :: ValueType -> Doc #

pprPrec :: Int -> ValueType -> Doc #

pprList :: [ValueType] -> Doc #

valueType :: Value -> ValueType Source #

A textual description of the type of a value. Follows Futhark type notation, and contains the exact dimension sizes if an array.

Comparing Values

compareValues :: [Value] -> [Value] -> [Mismatch] Source #

Compare two sets of Futhark values for equality. Shapes and types must also match.

compareValues1 :: [Value] -> [Value] -> Maybe Mismatch Source #

As compareValues, but only reports one mismatch.

data Mismatch Source #

Two values differ in some way. The Show instance produces a human-readable explanation.

Instances
Show Mismatch Source # 
Instance details

Defined in Futhark.Test.Values