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

Futhark.Test.Values

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 put to obtain binary a representation.

Instances

Instances details
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 #

type Vector = Vector Source #

An Unboxed vector.

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

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

Instances details
Show Mismatch Source # 
Instance details

Defined in Futhark.Test.Values