Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
Data.Array.Comfort.Shape
Synopsis
- class C sh where
- class C sh => Indexed sh where
- type Index sh
- indices :: sh -> [Index sh]
- offset :: sh -> Index sh -> Int
- uncheckedOffset :: sh -> Index sh -> Int
- unifiedOffset :: Checking check => sh -> Index sh -> Result check Int
- inBounds :: sh -> Index sh -> Bool
- sizeOffset :: sh -> (Int, Index sh -> Int)
- uncheckedSizeOffset :: sh -> (Int, Index sh -> Int)
- unifiedSizeOffset :: Checking check => sh -> (Int, Index sh -> Result check Int)
- class Indexed sh => InvIndexed sh where
- indexFromOffset :: sh -> Int -> Index sh
- uncheckedIndexFromOffset :: sh -> Int -> Index sh
- unifiedIndexFromOffset :: Checking check => sh -> Int -> Result check (Index sh)
- messageIndexFromOffset :: String -> Int -> String
- assertIndexFromOffset :: Checking check => String -> Int -> Bool -> Result check ()
- class (C sh, Eq sh) => Static sh where
- static :: sh
- class Indexed sh => Pattern sh where
- type DataPattern sh x
- indexPattern :: (Index sh -> x) -> sh -> DataPattern sh x
- requireCheck :: CheckSingleton check -> Result check a -> Result check a
- data CheckSingleton check where
- Checked :: CheckSingleton Checked
- Unchecked :: CheckSingleton Unchecked
- class Checking check where
- data Result check a
- switchCheck :: f Checked -> f Unchecked -> f check
- runChecked :: String -> Result Checked a -> a
- runUnchecked :: Result Unchecked a -> a
- assert :: Checking check => String -> Bool -> Result check ()
- throwOrError :: Checking check => String -> Result check a
- data Zero = Zero
- newtype ZeroBased n = ZeroBased {
- zeroBasedSize :: n
- zeroBasedSplit :: Real n => n -> ZeroBased n -> ZeroBased n ::+ ZeroBased n
- newtype OneBased n = OneBased {
- oneBasedSize :: n
- data Range n = Range {}
- data Shifted n = Shifted {
- shiftedOffset, shiftedSize :: n
- data Enumeration n = Enumeration
- newtype Deferred sh = Deferred sh
- newtype DeferredIndex sh = DeferredIndex Int
- deferIndex :: (Indexed sh, Index sh ~ ix) => sh -> ix -> DeferredIndex sh
- revealIndex :: (InvIndexed sh, Index sh ~ ix) => sh -> DeferredIndex sh -> ix
- data sh0 ::+ sh1 = sh0 ::+ sh1
- newtype Square sh = Square {
- squareSize :: sh
- newtype Cube sh = Cube {
- cubeSize :: sh
- data Triangular part size = Triangular {
- triangularPart :: part
- triangularSize :: size
- data Lower = Lower
- data Upper = Upper
- type LowerTriangular = Triangular Lower
- type UpperTriangular = Triangular Upper
- lowerTriangular :: size -> LowerTriangular size
- upperTriangular :: size -> UpperTriangular size
- triangleSize :: Int -> Int
- triangleRoot :: Floating a => a -> a
- data Simplex order coll f size = Simplex {
- simplexOrder :: SimplexOrder order
- simplexDimension :: f coll
- simplexSize :: size
- type SimplexAscending = Simplex Ascending
- simplexAscending :: f coll -> size -> SimplexAscending coll f size
- type SimplexDescending = Simplex Descending
- simplexDescending :: f coll -> size -> SimplexDescending coll f size
- data Ascending
- data Descending
- data SimplexOrder order where
- class SimplexOrderC order
- data AllDistinct = AllDistinct
- data SomeRepetitive = SomeRepetitive
- data Collision
- class CollisionC coll
- newtype Cyclic n = Cyclic {
- cyclicSize :: n
- newtype NestedTuple ixtype tuple = NestedTuple {
- getNestedTuple :: tuple
- class ElementTuple tuple => AccessorTuple tuple where
- tupleAccessors :: tuple -> [tuple -> Element]
- class (ElementTuple tuple, Eq tuple) => StaticTuple tuple where
- staticTuple :: State Element tuple
- newtype Element = Element Int
- data TupleAccessor
- data TupleIndex
- data ElementIndex tuple
- class ElementTuple tuple where
- type DataTuple tuple x
- indexTupleA :: Applicative f => (Element -> f a) -> tuple -> f (DataTuple tuple a)
- indexTupleFromShape :: ElementTuple tuple => NestedTuple TupleIndex tuple -> DataTuple tuple (ElementIndex tuple)
- newtype Record f = Record {}
- data FieldIndex (f :: * -> *)
- indexRecordFromShape :: Traversable f => Record f -> f (FieldIndex f)
- data Constructed tag
- data ConsIndex tag
- data Construction tag a
- construct :: Construction tag a -> (Constructed tag, a)
- consIndex :: Construction tag (ConsIndex tag)
Documentation
Instances
C Zero Source # | |
C () Source # | |
Defined in Data.Array.Comfort.Shape | |
C f => C (Shape f) Source # | |
C (Constructed tag) Source # | |
Defined in Data.Array.Comfort.Shape Methods size :: Constructed tag -> Int Source # | |
C sh => C (Cube sh) Source # | |
Integral n => C (Cyclic n) Source # | |
C sh => C (Deferred sh) Source # | |
(Enum n, Bounded n) => C (Enumeration n) Source # | |
Defined in Data.Array.Comfort.Shape Methods size :: Enumeration n -> Int Source # | |
Integral n => C (OneBased n) Source # | |
Ix n => C (Range n) Source # | |
Foldable f => C (Record f) Source # | |
Integral n => C (Shifted n) Source # | |
C sh => C (Square sh) Source # | |
Integral n => C (ZeroBased n) Source # | |
Ord n => C (Set n) Source # | |
(C sh0, C sh1) => C (sh0 ::+ sh1) Source # | |
ElementTuple tuple => C (NestedTuple ixtype tuple) Source # | |
Defined in Data.Array.Comfort.Shape Methods size :: NestedTuple ixtype tuple -> Int Source # | |
(TriangularPart part, C size) => C (Triangular part size) Source # | |
Defined in Data.Array.Comfort.Shape Methods size :: Triangular part size -> Int Source # | |
(Ord k, C shape) => C (Map k shape) Source # | Concatenate many arrays according to the shapes stored in a |
(C sh0, C sh1) => C (sh0, sh1) Source # | |
Defined in Data.Array.Comfort.Shape | |
C sh => C (Tagged s sh) Source # | |
(C sh0, C sh1, C sh2) => C (sh0, sh1, sh2) Source # | |
Defined in Data.Array.Comfort.Shape | |
(SimplexOrderC order, CollisionC coll, Traversable f, C size) => C (Simplex order coll f size) Source # | |
class C sh => Indexed sh where Source #
Minimal complete definition
Methods
indices :: sh -> [Index sh] Source #
offset :: sh -> Index sh -> Int Source #
uncheckedOffset :: sh -> Index sh -> Int Source #
unifiedOffset :: Checking check => sh -> Index sh -> Result check Int Source #
inBounds :: sh -> Index sh -> Bool Source #
sizeOffset :: sh -> (Int, Index sh -> Int) Source #
uncheckedSizeOffset :: sh -> (Int, Index sh -> Int) Source #
unifiedSizeOffset :: Checking check => sh -> (Int, Index sh -> Result check Int) Source #
Instances
class Indexed sh => InvIndexed sh where Source #
Minimal complete definition
Methods
indexFromOffset :: sh -> Int -> Index sh Source #
It should hold indexFromOffset sh k == indices sh !! k
,
but indexFromOffset
should generally be faster.
uncheckedIndexFromOffset :: sh -> Int -> Index sh Source #
unifiedIndexFromOffset :: Checking check => sh -> Int -> Result check (Index sh) Source #
Instances
class (C sh, Eq sh) => Static sh where Source #
Instances
class Indexed sh => Pattern sh where Source #
Associated Types
type DataPattern sh x Source #
Methods
indexPattern :: (Index sh -> x) -> sh -> DataPattern sh x Source #
Instances
requireCheck :: CheckSingleton check -> Result check a -> Result check a Source #
data CheckSingleton check where Source #
Constructors
Checked :: CheckSingleton Checked | |
Unchecked :: CheckSingleton Unchecked |
class Checking check where Source #
Methods
switchCheck :: f Checked -> f Unchecked -> f check Source #
runChecked :: String -> Result Checked a -> a Source #
runUnchecked :: Result Unchecked a -> a Source #
Constructors
Zero |
ZeroBased
denotes a range starting at zero and has a certain length.
>>>
Shape.indices (Shape.ZeroBased (7::Int))
[0,1,2,3,4,5,6]
Constructors
ZeroBased | |
Fields
|
Instances
OneBased
denotes a range starting at one and has a certain length.
>>>
Shape.indices (Shape.OneBased (7::Int))
[1,2,3,4,5,6,7]
Constructors
OneBased | |
Fields
|
Instances
Range
denotes an inclusive range like
those of the Haskell 98 standard Array
type from the array
package.
E.g. the shape type (Range Int32, Range Int64)
is equivalent to the ix type (Int32, Int64)
for Array
s.
>>>
Shape.indices (Shape.Range (-5) (5::Int))
[-5,-4,-3,-2,-1,0,1,2,3,4,5]>>>
Shape.indices (Shape.Range (-1,-1) (1::Int,1::Int))
[(-1,-1),(-1,0),(-1,1),(0,-1),(0,0),(0,1),(1,-1),(1,0),(1,1)]
Instances
Functor Range Source # | |
Storable n => Storable (Range n) Source # | |
Show n => Show (Range n) Source # | |
Ix n => C (Range n) Source # | |
Ix n => Indexed (Range n) Source # | |
Defined in Data.Array.Comfort.Shape Methods indices :: Range n -> [Index (Range n)] Source # offset :: Range n -> Index (Range n) -> Int Source # uncheckedOffset :: Range n -> Index (Range n) -> Int Source # unifiedOffset :: Checking check => Range n -> Index (Range n) -> Result check Int Source # inBounds :: Range n -> Index (Range n) -> Bool Source # sizeOffset :: Range n -> (Int, Index (Range n) -> Int) Source # uncheckedSizeOffset :: Range n -> (Int, Index (Range n) -> Int) Source # unifiedSizeOffset :: Checking check => Range n -> (Int, Index (Range n) -> Result check Int) Source # | |
Ix n => InvIndexed (Range n) Source # | |
NFData n => NFData (Range n) Source # | |
Defined in Data.Array.Comfort.Shape | |
Eq n => Eq (Range n) Source # | |
type Index (Range n) Source # | |
Defined in Data.Array.Comfort.Shape |
Shifted
denotes a range defined by the start index and the length.
>>>
Shape.indices (Shape.Shifted (-4) (8::Int))
[-4,-3,-2,-1,0,1,2,3]
Constructors
Shifted | |
Fields
|
Instances
data Enumeration n Source #
Enumeration
denotes a shape of fixed size
that is defined by Enum
and Bounded
methods.
For correctness it is necessary that the Enum
and Bounded
instances
are properly implemented.
Automatically derived instances are fine.
>>>
Shape.indices (Shape.Enumeration :: Shape.Enumeration Ordering)
[LT,EQ,GT]
Constructors
Enumeration |
Instances
This data type wraps another array shape.
Its index type is a wrapped Int
.
The advantages are:
No conversion forth and back Int
and Index sh
.
You can convert once using deferIndex
and revealIndex
whenever you need your application specific index type.
No need for e.g. Storable (Index sh)
, because Int
is already Storable
.
You get Indexed
and InvIndexed
instances
without the need for an Index
type.
The disadvantage is:
A deferred index should be bound to a specific shape, but this is not checked.
That is, you may obtain a deferred index for one shape
and accidentally abuse it for another shape without a warning.
Example:
>>>
:{
let sh2 = (Shape.ZeroBased (2::Int), Shape.ZeroBased (2::Int)) in let sh3 = (Shape.ZeroBased (3::Int), Shape.ZeroBased (3::Int)) in (Shape.offset sh3 $ Shape.indexFromOffset sh2 3, Shape.offset (Shape.Deferred sh3) $ Shape.indexFromOffset (Shape.Deferred sh2) 3) :} (4,3)
Constructors
Deferred sh |
Instances
newtype DeferredIndex sh Source #
DeferredIndex
has an Ord
instance
that is based on the storage order in memory.
This way, you can put DeferredIndex
values
in a Set
or use them as keys in a Map
even if Index sh
has no Ord
instance.
The downside is, that the ordering of DeferredIndex sh
may differ from the one of Index sh
.
Constructors
DeferredIndex Int |
Instances
deferIndex :: (Indexed sh, Index sh ~ ix) => sh -> ix -> DeferredIndex sh Source #
revealIndex :: (InvIndexed sh, Index sh ~ ix) => sh -> DeferredIndex sh -> ix Source #
data sh0 ::+ sh1 infixr 5 Source #
Row-major composition of two dimensions.
>>>
Shape.indices (Shape.ZeroBased (3::Int) ::+ Shape.Range 'a' 'c')
[Left 0,Left 1,Left 2,Right 'a',Right 'b',Right 'c']
Constructors
sh0 ::+ sh1 infixr 5 |
Instances
(Show sh0, Show sh1) => Show (sh0 ::+ sh1) Source # | |
(C sh0, C sh1) => C (sh0 ::+ sh1) Source # | |
(Indexed sh0, Indexed sh1) => Indexed (sh0 ::+ sh1) Source # | |
Defined in Data.Array.Comfort.Shape Methods indices :: (sh0 ::+ sh1) -> [Index (sh0 ::+ sh1)] Source # offset :: (sh0 ::+ sh1) -> Index (sh0 ::+ sh1) -> Int Source # uncheckedOffset :: (sh0 ::+ sh1) -> Index (sh0 ::+ sh1) -> Int Source # unifiedOffset :: Checking check => (sh0 ::+ sh1) -> Index (sh0 ::+ sh1) -> Result check Int Source # inBounds :: (sh0 ::+ sh1) -> Index (sh0 ::+ sh1) -> Bool Source # sizeOffset :: (sh0 ::+ sh1) -> (Int, Index (sh0 ::+ sh1) -> Int) Source # uncheckedSizeOffset :: (sh0 ::+ sh1) -> (Int, Index (sh0 ::+ sh1) -> Int) Source # unifiedSizeOffset :: Checking check => (sh0 ::+ sh1) -> (Int, Index (sh0 ::+ sh1) -> Result check Int) Source # | |
(InvIndexed sh0, InvIndexed sh1) => InvIndexed (sh0 ::+ sh1) Source # | |
Defined in Data.Array.Comfort.Shape | |
(Pattern sh0, Pattern sh1) => Pattern (sh0 ::+ sh1) Source # | |
Defined in Data.Array.Comfort.Shape Associated Types type DataPattern (sh0 ::+ sh1) x Source # Methods indexPattern :: (Index (sh0 ::+ sh1) -> x) -> (sh0 ::+ sh1) -> DataPattern (sh0 ::+ sh1) x Source # | |
(Static sh0, Static sh1) => Static (sh0 ::+ sh1) Source # | |
Defined in Data.Array.Comfort.Shape | |
(NFData sh0, NFData sh1) => NFData (sh0 ::+ sh1) Source # | |
Defined in Data.Array.Comfort.Shape | |
(Eq sh0, Eq sh1) => Eq (sh0 ::+ sh1) Source # | |
type Index (sh0 ::+ sh1) Source # | |
type DataPattern (sh0 ::+ sh1) x Source # | |
Defined in Data.Array.Comfort.Shape |
Square
is like a Cartesian product,
but it is statically asserted that both dimension shapes match.
>>>
Shape.indices $ Shape.Square $ Shape.ZeroBased (3::Int)
[(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2)]
Constructors
Square | |
Fields
|
Instances
Cube
is like a Cartesian product,
but it is statically asserted that both dimension shapes match.
>>>
Shape.indices $ Shape.Cube $ Shape.ZeroBased (2::Int)
[(0,0,0),(0,0,1),(0,1,0),(0,1,1),(1,0,0),(1,0,1),(1,1,0),(1,1,1)]
Instances
Applicative Cube Source # | |
Functor Cube Source # | |
Storable sh => Storable (Cube sh) Source # | |
Show sh => Show (Cube sh) Source # | |
C sh => C (Cube sh) Source # | |
Indexed sh => Indexed (Cube sh) Source # | |
Defined in Data.Array.Comfort.Shape Methods indices :: Cube sh -> [Index (Cube sh)] Source # offset :: Cube sh -> Index (Cube sh) -> Int Source # uncheckedOffset :: Cube sh -> Index (Cube sh) -> Int Source # unifiedOffset :: Checking check => Cube sh -> Index (Cube sh) -> Result check Int Source # inBounds :: Cube sh -> Index (Cube sh) -> Bool Source # sizeOffset :: Cube sh -> (Int, Index (Cube sh) -> Int) Source # uncheckedSizeOffset :: Cube sh -> (Int, Index (Cube sh) -> Int) Source # unifiedSizeOffset :: Checking check => Cube sh -> (Int, Index (Cube sh) -> Result check Int) Source # | |
InvIndexed sh => InvIndexed (Cube sh) Source # | |
NFData sh => NFData (Cube sh) Source # | |
Defined in Data.Array.Comfort.Shape | |
Eq sh => Eq (Cube sh) Source # | |
type Index (Cube sh) Source # | |
data Triangular part size Source #
>>>
Shape.indices $ Shape.Triangular Shape.Upper $ Shape.ZeroBased (3::Int)
[(0,0),(0,1),(0,2),(1,1),(1,2),(2,2)]>>>
Shape.indices $ Shape.Triangular Shape.Lower $ Shape.ZeroBased (3::Int)
[(0,0),(1,0),(1,1),(2,0),(2,1),(2,2)]
Constructors
Triangular | |
Fields
|
Instances
Constructors
Lower |
Constructors
Upper |
type LowerTriangular = Triangular Lower Source #
type UpperTriangular = Triangular Upper Source #
lowerTriangular :: size -> LowerTriangular size Source #
upperTriangular :: size -> UpperTriangular size Source #
triangleSize :: Int -> Int Source #
triangleRoot :: Floating a => a -> a Source #
data Simplex order coll f size Source #
Simplex is a generalization of Triangular
to more than two dimensions.
Indices are tuples of fixed size
with elements ordered in ascending, strictly ascending,
descending or strictly descending order.
"Order" refers to the index order in indices
.
In order to avoid confusion we suggest that the order of indices
is consistent with <=
.
Obviously, offset
implements ranking
and indexFromOffset
implements unranking
of combinations (in the combinatorial sense)
with or without repetitions.
>>>
Shape.indices $ Shape.simplexAscending (replicate 3 Shape.AllDistinct) $ Shape.ZeroBased (4::Int)
[[0,1,2],[0,1,3],[0,2,3],[1,2,3]]>>>
Shape.indices $ Shape.simplexAscending (replicate 3 Shape.SomeRepetitive) $ Shape.ZeroBased (3::Int)
[[0,0,0],[0,0,1],[0,0,2],[0,1,1],[0,1,2],[0,2,2],[1,1,1],[1,1,2],[1,2,2],[2,2,2]]>>>
Shape.indices $ Shape.simplexAscending [Shape.Repetitive,Shape.Distinct,Shape.Repetitive] $ Shape.ZeroBased (4::Int)
[[0,0,1],[0,0,2],[0,0,3],[0,1,2],[0,1,3],[0,2,3],[1,1,2],[1,1,3],[1,2,3],[2,2,3]]>>>
Shape.indices $ Shape.simplexAscending [Shape.Repetitive,Shape.Distinct,Shape.Distinct] $ Shape.ZeroBased (4::Int)
[[0,0,1],[0,0,2],[0,0,3],[0,1,2],[0,1,3],[0,2,3],[1,1,2],[1,1,3],[1,2,3],[2,2,3]]
>>>
Shape.indices $ Shape.simplexDescending (replicate 3 Shape.AllDistinct) $ Shape.ZeroBased (4::Int)
[[2,1,0],[3,1,0],[3,2,0],[3,2,1]]>>>
Shape.indices $ Shape.simplexDescending (replicate 3 Shape.SomeRepetitive) $ Shape.ZeroBased (3::Int)
[[0,0,0],[1,0,0],[1,1,0],[1,1,1],[2,0,0],[2,1,0],[2,1,1],[2,2,0],[2,2,1],[2,2,2]]>>>
Shape.indices $ Shape.simplexDescending [Shape.Repetitive,Shape.Distinct,Shape.Repetitive] $ Shape.ZeroBased (4::Int)
[[1,1,0],[2,1,0],[2,2,0],[2,2,1],[3,1,0],[3,2,0],[3,2,1],[3,3,0],[3,3,1],[3,3,2]]>>>
Shape.indices $ Shape.simplexDescending [Shape.Repetitive,Shape.Distinct,Shape.Distinct] $ Shape.ZeroBased (4::Int)
[[1,1,0],[2,1,0],[2,2,0],[2,2,1],[3,1,0],[3,2,0],[3,2,1],[3,3,0],[3,3,1],[3,3,2]]
Constructors
Simplex | |
Fields
|
Instances
(SimplexOrderC order, Show coll, Show1 f, Show size) => Show (Simplex order coll f size) Source # | |
(SimplexOrderC order, CollisionC coll, Traversable f, C size) => C (Simplex order coll f size) Source # | |
(SimplexOrderC order, CollisionC coll, Traversable f, Eq1 f, Indexed size) => Indexed (Simplex order coll f size) Source # | |
Defined in Data.Array.Comfort.Shape Methods indices :: Simplex order coll f size -> [Index (Simplex order coll f size)] Source # offset :: Simplex order coll f size -> Index (Simplex order coll f size) -> Int Source # uncheckedOffset :: Simplex order coll f size -> Index (Simplex order coll f size) -> Int Source # unifiedOffset :: Checking check => Simplex order coll f size -> Index (Simplex order coll f size) -> Result check Int Source # inBounds :: Simplex order coll f size -> Index (Simplex order coll f size) -> Bool Source # sizeOffset :: Simplex order coll f size -> (Int, Index (Simplex order coll f size) -> Int) Source # uncheckedSizeOffset :: Simplex order coll f size -> (Int, Index (Simplex order coll f size) -> Int) Source # unifiedSizeOffset :: Checking check => Simplex order coll f size -> (Int, Index (Simplex order coll f size) -> Result check Int) Source # | |
(SimplexOrderC order, CollisionC coll, Traversable f, Eq1 f, InvIndexed size) => InvIndexed (Simplex order coll f size) Source # | |
Defined in Data.Array.Comfort.Shape Methods indexFromOffset :: Simplex order coll f size -> Int -> Index (Simplex order coll f size) Source # uncheckedIndexFromOffset :: Simplex order coll f size -> Int -> Index (Simplex order coll f size) Source # unifiedIndexFromOffset :: Checking check => Simplex order coll f size -> Int -> Result check (Index (Simplex order coll f size)) Source # | |
type Index (Simplex order coll f size) Source # | |
Defined in Data.Array.Comfort.Shape |
type SimplexAscending = Simplex Ascending Source #
simplexAscending :: f coll -> size -> SimplexAscending coll f size Source #
type SimplexDescending = Simplex Descending Source #
simplexDescending :: f coll -> size -> SimplexDescending coll f size Source #
Instances
SimplexOrderC Ascending Source # | |
Defined in Data.Array.Comfort.Shape |
data Descending Source #
Instances
SimplexOrderC Descending Source # | |
Defined in Data.Array.Comfort.Shape |
data SimplexOrder order where Source #
Constructors
Ascending :: SimplexOrder Ascending | |
Descending :: SimplexOrder Descending |
Instances
Show (SimplexOrder order) Source # | |
Defined in Data.Array.Comfort.Shape Methods showsPrec :: Int -> SimplexOrder order -> ShowS # show :: SimplexOrder order -> String # showList :: [SimplexOrder order] -> ShowS # | |
Eq (SimplexOrder order) Source # | |
Defined in Data.Array.Comfort.Shape Methods (==) :: SimplexOrder order -> SimplexOrder order -> Bool # (/=) :: SimplexOrder order -> SimplexOrder order -> Bool # |
class SimplexOrderC order Source #
Instances
SimplexOrderC Ascending Source # | |
Defined in Data.Array.Comfort.Shape | |
SimplexOrderC Descending Source # | |
Defined in Data.Array.Comfort.Shape |
data AllDistinct Source #
Constructors
AllDistinct |
Instances
Show AllDistinct Source # | |
Defined in Data.Array.Comfort.Shape Methods showsPrec :: Int -> AllDistinct -> ShowS # show :: AllDistinct -> String # showList :: [AllDistinct] -> ShowS # | |
CollisionC AllDistinct Source # | |
Defined in Data.Array.Comfort.Shape Methods repetitionAllowed :: AllDistinct -> Bool | |
Eq AllDistinct Source # | |
Defined in Data.Array.Comfort.Shape |
data SomeRepetitive Source #
Constructors
SomeRepetitive |
Instances
Show SomeRepetitive Source # | |
Defined in Data.Array.Comfort.Shape Methods showsPrec :: Int -> SomeRepetitive -> ShowS # show :: SomeRepetitive -> String # showList :: [SomeRepetitive] -> ShowS # | |
CollisionC SomeRepetitive Source # | |
Defined in Data.Array.Comfort.Shape Methods | |
Eq SomeRepetitive Source # | |
Defined in Data.Array.Comfort.Shape Methods (==) :: SomeRepetitive -> SomeRepetitive -> Bool # (/=) :: SomeRepetitive -> SomeRepetitive -> Bool # |
Constructors
Distinct | |
Repetitive |
Instances
Enum Collision Source # | |
Defined in Data.Array.Comfort.Shape Methods succ :: Collision -> Collision # pred :: Collision -> Collision # fromEnum :: Collision -> Int # enumFrom :: Collision -> [Collision] # enumFromThen :: Collision -> Collision -> [Collision] # enumFromTo :: Collision -> Collision -> [Collision] # enumFromThenTo :: Collision -> Collision -> Collision -> [Collision] # | |
Show Collision Source # | |
CollisionC Collision Source # | |
Defined in Data.Array.Comfort.Shape Methods repetitionAllowed :: Collision -> Bool | |
Eq Collision Source # | |
Ord Collision Source # | |
class CollisionC coll Source #
Minimal complete definition
repetitionAllowed
Instances
CollisionC AllDistinct Source # | |
Defined in Data.Array.Comfort.Shape Methods repetitionAllowed :: AllDistinct -> Bool | |
CollisionC Collision Source # | |
Defined in Data.Array.Comfort.Shape Methods repetitionAllowed :: Collision -> Bool | |
CollisionC SomeRepetitive Source # | |
Defined in Data.Array.Comfort.Shape Methods |
Cyclic
is a shape, where the indices wrap around at the array boundaries.
E.g.
let shape = Shape.Cyclic (10::Int) in Shape.offset shape (-1) == Shape.offset shape 9
This also means that there are multiple indices that address the same array element.
>>>
Shape.indices (Shape.Cyclic (7::Int))
[0,1,2,3,4,5,6]
Constructors
Cyclic | |
Fields
|
Instances
newtype NestedTuple ixtype tuple Source #
Shape for arrays that hold elements that can alternatively be stored in nested tuples.
Constructors
NestedTuple | |
Fields
|
Instances
class ElementTuple tuple => AccessorTuple tuple where Source #
Methods
tupleAccessors :: tuple -> [tuple -> Element] Source #
Instances
AccessorTuple Element Source # | |
Defined in Data.Array.Comfort.Shape | |
AccessorTuple () Source # | |
Defined in Data.Array.Comfort.Shape Methods tupleAccessors :: () -> [() -> Element] Source # | |
(AccessorTuple a, RealFloat a) => AccessorTuple (Complex a) Source # | |
Defined in Data.Array.Comfort.Shape | |
(AccessorTuple a, AccessorTuple b) => AccessorTuple (a, b) Source # | |
Defined in Data.Array.Comfort.Shape Methods tupleAccessors :: (a, b) -> [(a, b) -> Element] Source # | |
(AccessorTuple a, AccessorTuple b, AccessorTuple c) => AccessorTuple (a, b, c) Source # | |
Defined in Data.Array.Comfort.Shape Methods tupleAccessors :: (a, b, c) -> [(a, b, c) -> Element] Source # | |
(AccessorTuple a, AccessorTuple b, AccessorTuple c, AccessorTuple d) => AccessorTuple (a, b, c, d) Source # | |
Defined in Data.Array.Comfort.Shape Methods tupleAccessors :: (a, b, c, d) -> [(a, b, c, d) -> Element] Source # |
class (ElementTuple tuple, Eq tuple) => StaticTuple tuple where Source #
Methods
staticTuple :: State Element tuple Source #
Instances
StaticTuple Element Source # | |
Defined in Data.Array.Comfort.Shape | |
StaticTuple () Source # | |
Defined in Data.Array.Comfort.Shape Methods staticTuple :: State Element () Source # | |
StaticTuple a => StaticTuple (Complex a) Source # | |
Defined in Data.Array.Comfort.Shape | |
(StaticTuple a, StaticTuple b) => StaticTuple (a, b) Source # | |
Defined in Data.Array.Comfort.Shape Methods staticTuple :: State Element (a, b) Source # | |
(StaticTuple a, StaticTuple b, StaticTuple c) => StaticTuple (a, b, c) Source # | |
Defined in Data.Array.Comfort.Shape Methods staticTuple :: State Element (a, b, c) Source # | |
(StaticTuple a, StaticTuple b, StaticTuple c, StaticTuple d) => StaticTuple (a, b, c, d) Source # | |
Defined in Data.Array.Comfort.Shape Methods staticTuple :: State Element (a, b, c, d) Source # |
Instances
Show Element Source # | |
AccessorTuple Element Source # | |
Defined in Data.Array.Comfort.Shape | |
ElementTuple Element Source # | |
Defined in Data.Array.Comfort.Shape Methods indexTupleA :: Applicative f => (Element -> f a) -> Element -> f (DataTuple Element a) Source # | |
StaticTuple Element Source # | |
Defined in Data.Array.Comfort.Shape | |
NFData Element Source # | |
Defined in Data.Array.Comfort.Shape | |
Eq Element Source # | |
type DataTuple Element x Source # | |
Defined in Data.Array.Comfort.Shape |
data TupleAccessor Source #
Instances
data TupleIndex Source #
Instances
data ElementIndex tuple Source #
Instances
Show (ElementIndex tuple) Source # | |
Defined in Data.Array.Comfort.Shape Methods showsPrec :: Int -> ElementIndex tuple -> ShowS # show :: ElementIndex tuple -> String # showList :: [ElementIndex tuple] -> ShowS # | |
Eq (ElementIndex tuple) Source # | |
Defined in Data.Array.Comfort.Shape Methods (==) :: ElementIndex tuple -> ElementIndex tuple -> Bool # (/=) :: ElementIndex tuple -> ElementIndex tuple -> Bool # | |
Ord (ElementIndex tuple) Source # | |
Defined in Data.Array.Comfort.Shape Methods compare :: ElementIndex tuple -> ElementIndex tuple -> Ordering # (<) :: ElementIndex tuple -> ElementIndex tuple -> Bool # (<=) :: ElementIndex tuple -> ElementIndex tuple -> Bool # (>) :: ElementIndex tuple -> ElementIndex tuple -> Bool # (>=) :: ElementIndex tuple -> ElementIndex tuple -> Bool # max :: ElementIndex tuple -> ElementIndex tuple -> ElementIndex tuple # min :: ElementIndex tuple -> ElementIndex tuple -> ElementIndex tuple # |
class ElementTuple tuple where Source #
Methods
indexTupleA :: Applicative f => (Element -> f a) -> tuple -> f (DataTuple tuple a) Source #
Instances
indexTupleFromShape :: ElementTuple tuple => NestedTuple TupleIndex tuple -> DataTuple tuple (ElementIndex tuple) Source #
Shape for arrays that hold elements
that can alternatively be stored in a Traversable
record.
Instances
Foldable f => C (Record f) Source # | |
Foldable f => Indexed (Record f) Source # | |
Defined in Data.Array.Comfort.Shape Methods indices :: Record f -> [Index (Record f)] Source # offset :: Record f -> Index (Record f) -> Int Source # uncheckedOffset :: Record f -> Index (Record f) -> Int Source # unifiedOffset :: Checking check => Record f -> Index (Record f) -> Result check Int Source # inBounds :: Record f -> Index (Record f) -> Bool Source # sizeOffset :: Record f -> (Int, Index (Record f) -> Int) Source # uncheckedSizeOffset :: Record f -> (Int, Index (Record f) -> Int) Source # unifiedSizeOffset :: Checking check => Record f -> (Int, Index (Record f) -> Result check Int) Source # | |
(Applicative f, Traversable f) => Static (Record f) Source # | |
Defined in Data.Array.Comfort.Shape | |
Foldable f => Eq (Record f) Source # | |
type Index (Record f) Source # | |
Defined in Data.Array.Comfort.Shape |
data FieldIndex (f :: * -> *) Source #
Instances
Show (FieldIndex f) Source # | |
Defined in Data.Array.Comfort.Shape Methods showsPrec :: Int -> FieldIndex f -> ShowS # show :: FieldIndex f -> String # showList :: [FieldIndex f] -> ShowS # | |
Eq (FieldIndex f) Source # | |
Defined in Data.Array.Comfort.Shape |
indexRecordFromShape :: Traversable f => Record f -> f (FieldIndex f) Source #
data Constructed tag Source #
Instances
data Construction tag a Source #
Instances
Applicative (Construction tag) Source # | |
Defined in Data.Array.Comfort.Shape Methods pure :: a -> Construction tag a # (<*>) :: Construction tag (a -> b) -> Construction tag a -> Construction tag b # liftA2 :: (a -> b -> c) -> Construction tag a -> Construction tag b -> Construction tag c # (*>) :: Construction tag a -> Construction tag b -> Construction tag b # (<*) :: Construction tag a -> Construction tag b -> Construction tag a # | |
Functor (Construction tag) Source # | |
Defined in Data.Array.Comfort.Shape Methods fmap :: (a -> b) -> Construction tag a -> Construction tag b # (<$) :: a -> Construction tag b -> Construction tag a # | |
Monad (Construction tag) Source # | |
Defined in Data.Array.Comfort.Shape Methods (>>=) :: Construction tag a -> (a -> Construction tag b) -> Construction tag b # (>>) :: Construction tag a -> Construction tag b -> Construction tag b # return :: a -> Construction tag a # |
construct :: Construction tag a -> (Constructed tag, a) Source #
consIndex :: Construction tag (ConsIndex tag) Source #