Safe Haskell | Safe |
---|---|

Language | Haskell98 |

Class of types that can be used as array shapes and indices.

# Documentation

class Eq sh => Shape sh where #

Class of types that can be used as array shapes and indices.

rank, zeroDim, unitDim, intersectDim, addDim, size, sizeIsValid, toIndex, fromIndex, inShapeRange, listOfShape, shapeOfList, deepSeq

Get the number of dimensions in a shape.

The shape of an array of size zero, with a particular dimensionality.

The shape of an array with size one, with a particular dimensionality.

intersectDim :: sh -> sh -> sh #

Compute the intersection of two shapes.

Add the coordinates of two shapes componentwise

Get the total number of elements in an array with this shape.

sizeIsValid :: sh -> Bool #

Check whether this shape is small enough so that its flat
indices an be represented as `Int`

. If this returns `False`

then your
array is too big. Mostly used for writing QuickCheck tests.

Convert an index into its equivalent flat, linear, row-major version.

fromIndex :: sh -> Int -> sh #

Inverse of `toIndex`

.

inShapeRange :: sh -> sh -> sh -> Bool #

Check whether an index is within a given shape.

listOfShape :: sh -> [Int] #

Convert a shape into its list of dimensions.

shapeOfList :: [Int] -> sh #

Convert a list of dimensions to a shape

deepSeq :: sh -> a -> a infixr 0 #

Ensure that a shape is completely evaluated.

Check whether an index is a part of a given shape.