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

Safe Haskell | Safe-Inferred
Language | GHC2021

Futhark.Test.Values

Contents

- Orphan instances

Description

This module provides an efficient value representation as well as parsing and comparison functions.

Synopsis

- module Futhark.Data
- module Futhark.Data.Compare
- module Futhark.Data.Reader
- data Compound v
  - = ValueRecord (Map Text (Compound v))
  - | ValueTuple [Compound v]
  - | ValueAtom v
- type CompoundValue = Compound Value
- mkCompound :: [Compound v] -> Compound v
- unCompound :: Compound v -> [Compound v]

# Documentation

module Futhark.Data

module Futhark.Data.Compare

module Futhark.Data.Reader

data Compound v Source #

The structure of a compound value, parameterised over the actual values. For most cases you probably want `CompoundValue`.

Constructors

ValueRecord (Map Text (Compound v)) |
ValueTuple [Compound v] | Must not be single value.
ValueAtom v |

#### Instances

Instances details

Foldable Compound Source # |

Instance details

Defined in Futhark.Test.Values

Methods

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

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

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

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

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

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

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

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

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

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

null :: Compound a -> Bool Source #

length :: Compound a -> Int Source #

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

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

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

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

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

Traversable Compound Source # |
Instance details Defined in Futhark.Test.Values Methods traverse :: Applicative f => (a -> f b) -> Compound a -> f (Compound b) Source # sequenceA :: Applicative f => Compound (f a) -> f (Compound a) Source # mapM :: Monad m => (a -> m b) -> Compound a -> m (Compound b) Source # sequence :: Monad m => Compound (m a) -> m (Compound a) Source #
Functor Compound Source # |
Instance details Defined in Futhark.Test.Values Methods fmap :: (a -> b) -> Compound a -> Compound b Source # (<$) :: a -> Compound b -> Compound a Source #
Show v => Show (Compound v) Source # |
Instance details Defined in Futhark.Test.Values Methods showsPrec :: Int -> Compound v -> ShowS Source # show :: Compound v -> String Source # showList :: [Compound v] -> ShowS Source #
Eq v => Eq (Compound v) Source # |
Instance details Defined in Futhark.Test.Values Methods (==) :: Compound v -> Compound v -> Bool Source # (/=) :: Compound v -> Compound v -> Bool Source #
Ord v => Ord (Compound v) Source # |

Instance details

Defined in Futhark.Test.Values

Methods

compare :: Compound v -> Compound v -> Ordering Source #

(<) :: Compound v -> Compound v -> Bool Source #

(<=) :: Compound v -> Compound v -> Bool Source #

(>) :: Compound v -> Compound v -> Bool Source #

(>=) :: Compound v -> Compound v -> Bool Source #

max :: Compound v -> Compound v -> Compound v Source #

min :: Compound v -> Compound v -> Compound v Source #

Pretty v => Pretty (Compound v) Source # |
Instance details Defined in Futhark.Test.Values Methods pretty :: Compound v -> Doc ann Source # prettyList :: [Compound v] -> Doc ann Source #

type CompoundValue = Compound Value Source #

Like a `Value`, but also grouped in compound ways that are not supported by raw values. You cannot parse or read these in standard ways, and they cannot be elements of arrays.

mkCompound :: [Compound v] -> Compound v Source #

Create a tuple for a non-unit list, and otherwise a `ValueAtom`

unCompound :: Compound v -> [Compound v] Source #

If the value is a tuple, extract the components, otherwise return a singleton list of the value.

# Orphan instances

Pretty Value Source # |
Instance details Methods pretty :: Value -> Doc ann Source # prettyList :: [Value] -> Doc ann Source #
Pretty ValueType Source # |
Instance details Methods pretty :: ValueType -> Doc ann Source # prettyList :: [ValueType] -> Doc ann Source #