Copyright | (c) Alexey Kuleshevich 2018-2019 |
---|---|
License | BSD3 |
Maintainer | Alexey Kuleshevich <lehins@yandex.ru> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- data family Array r ix e :: *
- type Vector r e = Array r Ix1 e
- type MVector s r e = MArray s r Ix1 e
- type Matrix r e = Array r Ix2 e
- type MMatrix s r e = MArray s r Ix2 e
- type family Elt r ix e :: * where ...
- class (Typeable r, Index ix) => Construct r ix e
- class (Typeable r, Index ix) => Load r ix e where
- type R r :: *
- loadArrayM :: Monad m => Scheduler m () -> Array r ix e -> (Int -> e -> m ()) -> m ()
- defaultElement :: Array r ix e -> Maybe e
- class Load r ix e => Stream r ix e where
- class Load r ix e => Source r ix e
- class Index ix => Resize r ix
- class Load r ix e => Extract r ix e
- class Load r ix e => StrideLoad r ix e where
- class Load r ix e => Slice r ix e
- class Load r ix e => OuterSlice r ix e
- class Load r ix e => InnerSlice r ix e
- class (Load r ix e, Source r ix e) => Manifest r ix e
- class (Construct r ix e, Manifest r ix e) => Mutable r ix e
- class Construct r ix e => Ragged r ix e
- class Nested r ix e where
- fromNested :: NestedStruct r ix e -> Array r ix e
- toNested :: Array r ix e -> NestedStruct r ix e
- type family NestedStruct r ix e :: *
- data L = L
- data LN
- type family ListItem ix e :: * where ...
- data Comp where
- data WorkerStates s
- initWorkerStates :: MonadIO m => Comp -> (WorkerId -> m s) -> m (WorkerStates s)
- module Data.Massiv.Core.Index
- class Monad m => MonadThrow (m :: Type -> Type) where
- throw :: Exception e => e -> a
- class (Typeable e, Show e) => Exception e where
- toException :: e -> SomeException
- fromException :: SomeException -> Maybe e
- displayException :: e -> String
- data SomeException
- data IndexException where
- IndexZeroException :: Index ix => !ix -> IndexException
- IndexDimensionException :: (NFData ix, Show ix, Typeable ix) => !ix -> !Dim -> IndexException
- IndexOutOfBoundsException :: Index ix => !(Sz ix) -> !ix -> IndexException
- data SizeException where
- SizeMismatchException :: Index ix => !(Sz ix) -> !(Sz ix) -> SizeException
- SizeElementsMismatchException :: (Index ix, Index ix') => !(Sz ix) -> !(Sz ix') -> SizeException
- SizeSubregionException :: Index ix => !(Sz ix) -> !ix -> !(Sz ix) -> SizeException
- SizeEmptyException :: Index ix => !(Sz ix) -> SizeException
- data ShapeException
- newtype ImpossibleException = ImpossibleException SomeException
- throwImpossible :: Exception e => e -> a
- data Uninitialized = Uninitialized
- guardNumberOfElements :: (MonadThrow m, Index ix, Index ix') => Sz ix -> Sz ix' -> m ()
- class MonadIO m => MonadUnliftIO (m :: Type -> Type)
- class Monad m => MonadIO (m :: Type -> Type) where
- class Monad m => PrimMonad (m :: Type -> Type) where
Documentation
data family Array r ix e :: * Source #
The array family. Representations r
describes how data is arranged or computed. All arrays
have a common property that each index ix
always maps to the same unique element, even if that
element does not exist in memory and has to be computed upon lookup. Data is always arranged in a
nested fashion, depth of which is controlled by
.Rank
ix
Instances
Monad (Array DS Ix1) Source # | |
Functor (Array DL ix) Source # | |
Functor (Array D ix) Source # | |
Functor (Array DS Ix1) Source # | |
Index ix => Functor (Array B ix) Source # | |
Functor (Array DW ix) Source # | |
Functor (Array DI ix) Source # | |
Index ix => Applicative (Array D ix) Source # | |
Defined in Data.Massiv.Array.Delayed.Pull | |
Applicative (Array DS Ix1) Source # | |
Defined in Data.Massiv.Array.Delayed.Stream | |
Index ix => Applicative (Array DI ix) Source # | |
Defined in Data.Massiv.Array.Delayed.Interleaved | |
Index ix => Foldable (Array D ix) Source # | Row-major sequential folding over a Delayed array. |
Defined in Data.Massiv.Array.Delayed.Pull fold :: Monoid m => Array D ix m -> m # foldMap :: Monoid m => (a -> m) -> Array D ix a -> m # foldr :: (a -> b -> b) -> b -> Array D ix a -> b # foldr' :: (a -> b -> b) -> b -> Array D ix a -> b # foldl :: (b -> a -> b) -> b -> Array D ix a -> b # foldl' :: (b -> a -> b) -> b -> Array D ix a -> b # foldr1 :: (a -> a -> a) -> Array D ix a -> a # foldl1 :: (a -> a -> a) -> Array D ix a -> a # toList :: Array D ix a -> [a] # null :: Array D ix a -> Bool # length :: Array D ix a -> Int # elem :: Eq a => a -> Array D ix a -> Bool # maximum :: Ord a => Array D ix a -> a # minimum :: Ord a => Array D ix a -> a # | |
Index ix => Foldable (Array M ix) Source # | Row-major sequentia folding over a Manifest array. |
Defined in Data.Massiv.Array.Manifest.Internal fold :: Monoid m => Array M ix m -> m # foldMap :: Monoid m => (a -> m) -> Array M ix a -> m # foldr :: (a -> b -> b) -> b -> Array M ix a -> b # foldr' :: (a -> b -> b) -> b -> Array M ix a -> b # foldl :: (b -> a -> b) -> b -> Array M ix a -> b # foldl' :: (b -> a -> b) -> b -> Array M ix a -> b # foldr1 :: (a -> a -> a) -> Array M ix a -> a # foldl1 :: (a -> a -> a) -> Array M ix a -> a # toList :: Array M ix a -> [a] # null :: Array M ix a -> Bool # length :: Array M ix a -> Int # elem :: Eq a => a -> Array M ix a -> Bool # maximum :: Ord a => Array M ix a -> a # minimum :: Ord a => Array M ix a -> a # | |
Foldable (Array DS Ix1) Source # | |
Defined in Data.Massiv.Array.Delayed.Stream fold :: Monoid m => Array DS Ix1 m -> m # foldMap :: Monoid m => (a -> m) -> Array DS Ix1 a -> m # foldr :: (a -> b -> b) -> b -> Array DS Ix1 a -> b # foldr' :: (a -> b -> b) -> b -> Array DS Ix1 a -> b # foldl :: (b -> a -> b) -> b -> Array DS Ix1 a -> b # foldl' :: (b -> a -> b) -> b -> Array DS Ix1 a -> b # foldr1 :: (a -> a -> a) -> Array DS Ix1 a -> a # foldl1 :: (a -> a -> a) -> Array DS Ix1 a -> a # toList :: Array DS Ix1 a -> [a] # null :: Array DS Ix1 a -> Bool # length :: Array DS Ix1 a -> Int # elem :: Eq a => a -> Array DS Ix1 a -> Bool # maximum :: Ord a => Array DS Ix1 a -> a # minimum :: Ord a => Array DS Ix1 a -> a # | |
Index ix => Foldable (Array B ix) Source # | Row-major sequential folding over a Boxed array. |
Defined in Data.Massiv.Array.Manifest.Boxed fold :: Monoid m => Array B ix m -> m # foldMap :: Monoid m => (a -> m) -> Array B ix a -> m # foldr :: (a -> b -> b) -> b -> Array B ix a -> b # foldr' :: (a -> b -> b) -> b -> Array B ix a -> b # foldl :: (b -> a -> b) -> b -> Array B ix a -> b # foldl' :: (b -> a -> b) -> b -> Array B ix a -> b # foldr1 :: (a -> a -> a) -> Array B ix a -> a # foldl1 :: (a -> a -> a) -> Array B ix a -> a # toList :: Array B ix a -> [a] # null :: Array B ix a -> Bool # length :: Array B ix a -> Int # elem :: Eq a => a -> Array B ix a -> Bool # maximum :: Ord a => Array B ix a -> a # minimum :: Ord a => Array B ix a -> a # | |
Index ix => Foldable (Array DI ix) Source # | |
Defined in Data.Massiv.Array.Delayed.Interleaved fold :: Monoid m => Array DI ix m -> m # foldMap :: Monoid m => (a -> m) -> Array DI ix a -> m # foldr :: (a -> b -> b) -> b -> Array DI ix a -> b # foldr' :: (a -> b -> b) -> b -> Array DI ix a -> b # foldl :: (b -> a -> b) -> b -> Array DI ix a -> b # foldl' :: (b -> a -> b) -> b -> Array DI ix a -> b # foldr1 :: (a -> a -> a) -> Array DI ix a -> a # foldl1 :: (a -> a -> a) -> Array DI ix a -> a # toList :: Array DI ix a -> [a] # null :: Array DI ix a -> Bool # length :: Array DI ix a -> Int # elem :: Eq a => a -> Array DI ix a -> Bool # maximum :: Ord a => Array DI ix a -> a # minimum :: Ord a => Array DI ix a -> a # | |
Index ix => Traversable (Array B ix) Source # | |
Defined in Data.Massiv.Array.Manifest.Boxed | |
Nested LN ix e => IsList (Array L ix e) Source # | |
Nested LN ix e => IsList (Array LN ix e) Source # | |
(Unbox e, IsList (Array L ix e), Nested LN ix e, Nested L ix e, Ragged L ix e) => IsList (Array U ix e) Source # | |
(Prim e, IsList (Array L ix e), Nested LN ix e, Nested L ix e, Ragged L ix e) => IsList (Array P ix e) Source # | |
(Storable e, IsList (Array L ix e), Nested LN ix e, Nested L ix e, Ragged L ix e) => IsList (Array S ix e) Source # | |
IsList (Array DS Ix1 e) Source # | |
(NFData e, IsList (Array L ix e), Nested LN ix e, Nested L ix e, Ragged L ix e) => IsList (Array N ix e) Source # | |
(IsList (Array L ix e), Nested LN ix e, Nested L ix e, Ragged L ix e) => IsList (Array B ix e) Source # | |
(Eq e, Index ix) => Eq (Array D ix e) Source # | |
(Eq e, Index ix) => Eq (Array M ix e) Source # | |
(Unbox e, Eq e, Index ix) => Eq (Array U ix e) Source # | |
(Prim e, Eq e, Index ix) => Eq (Array P ix e) Source # | |
(Storable e, Eq e, Index ix) => Eq (Array S ix e) Source # | |
(Index ix, NFData e, Eq e) => Eq (Array N ix e) Source # | |
(Index ix, Eq e) => Eq (Array B ix e) Source # | |
(Index ix, Eq e) => Eq (Array DI ix e) Source # | |
(Index ix, Floating e) => Floating (Array D ix e) Source # | |
Defined in Data.Massiv.Array.Delayed.Pull exp :: Array D ix e -> Array D ix e # log :: Array D ix e -> Array D ix e # sqrt :: Array D ix e -> Array D ix e # (**) :: Array D ix e -> Array D ix e -> Array D ix e # logBase :: Array D ix e -> Array D ix e -> Array D ix e # sin :: Array D ix e -> Array D ix e # cos :: Array D ix e -> Array D ix e # tan :: Array D ix e -> Array D ix e # asin :: Array D ix e -> Array D ix e # acos :: Array D ix e -> Array D ix e # atan :: Array D ix e -> Array D ix e # sinh :: Array D ix e -> Array D ix e # cosh :: Array D ix e -> Array D ix e # tanh :: Array D ix e -> Array D ix e # asinh :: Array D ix e -> Array D ix e # acosh :: Array D ix e -> Array D ix e # atanh :: Array D ix e -> Array D ix e # log1p :: Array D ix e -> Array D ix e # expm1 :: Array D ix e -> Array D ix e # | |
(Index ix, Floating e) => Floating (Array DI ix e) Source # | |
Defined in Data.Massiv.Array.Delayed.Interleaved exp :: Array DI ix e -> Array DI ix e # log :: Array DI ix e -> Array DI ix e # sqrt :: Array DI ix e -> Array DI ix e # (**) :: Array DI ix e -> Array DI ix e -> Array DI ix e # logBase :: Array DI ix e -> Array DI ix e -> Array DI ix e # sin :: Array DI ix e -> Array DI ix e # cos :: Array DI ix e -> Array DI ix e # tan :: Array DI ix e -> Array DI ix e # asin :: Array DI ix e -> Array DI ix e # acos :: Array DI ix e -> Array DI ix e # atan :: Array DI ix e -> Array DI ix e # sinh :: Array DI ix e -> Array DI ix e # cosh :: Array DI ix e -> Array DI ix e # tanh :: Array DI ix e -> Array DI ix e # asinh :: Array DI ix e -> Array DI ix e # acosh :: Array DI ix e -> Array DI ix e # atanh :: Array DI ix e -> Array DI ix e # log1p :: Array DI ix e -> Array DI ix e # expm1 :: Array DI ix e -> Array DI ix e # | |
(Index ix, Fractional e) => Fractional (Array D ix e) Source # | |
(Index ix, Fractional e) => Fractional (Array DI ix e) Source # | |
(Index ix, Num e) => Num (Array D ix e) Source # | |
Defined in Data.Massiv.Array.Delayed.Pull (+) :: Array D ix e -> Array D ix e -> Array D ix e # (-) :: Array D ix e -> Array D ix e -> Array D ix e # (*) :: Array D ix e -> Array D ix e -> Array D ix e # negate :: Array D ix e -> Array D ix e # abs :: Array D ix e -> Array D ix e # signum :: Array D ix e -> Array D ix e # fromInteger :: Integer -> Array D ix e # | |
(Index ix, Num e) => Num (Array DI ix e) Source # | |
Defined in Data.Massiv.Array.Delayed.Interleaved (+) :: Array DI ix e -> Array DI ix e -> Array DI ix e # (-) :: Array DI ix e -> Array DI ix e -> Array DI ix e # (*) :: Array DI ix e -> Array DI ix e -> Array DI ix e # negate :: Array DI ix e -> Array DI ix e # abs :: Array DI ix e -> Array DI ix e # signum :: Array DI ix e -> Array DI ix e # fromInteger :: Integer -> Array DI ix e # | |
(Ord e, Index ix) => Ord (Array D ix e) Source # | |
Defined in Data.Massiv.Array.Delayed.Pull | |
(Ord e, Index ix) => Ord (Array M ix e) Source # | |
Defined in Data.Massiv.Array.Manifest.Internal | |
(Unbox e, Ord e, Index ix) => Ord (Array U ix e) Source # | |
Defined in Data.Massiv.Array.Manifest.Unboxed | |
(Prim e, Ord e, Index ix) => Ord (Array P ix e) Source # | |
Defined in Data.Massiv.Array.Manifest.Primitive | |
(Storable e, Ord e, Index ix) => Ord (Array S ix e) Source # | |
Defined in Data.Massiv.Array.Manifest.Storable | |
(Index ix, NFData e, Ord e) => Ord (Array N ix e) Source # | |
Defined in Data.Massiv.Array.Manifest.Boxed | |
(Index ix, Ord e) => Ord (Array B ix e) Source # | |
Defined in Data.Massiv.Array.Manifest.Boxed | |
(Index ix, Ord e) => Ord (Array DI ix e) Source # | |
Defined in Data.Massiv.Array.Delayed.Interleaved compare :: Array DI ix e -> Array DI ix e -> Ordering # (<) :: Array DI ix e -> Array DI ix e -> Bool # (<=) :: Array DI ix e -> Array DI ix e -> Bool # (>) :: Array DI ix e -> Array DI ix e -> Bool # (>=) :: Array DI ix e -> Array DI ix e -> Bool # | |
(Ragged L ix e, Show e) => Show (Array DL ix e) Source # | |
(Ragged L ix e, Show e) => Show (Array L ix e) Source # | |
(Ragged L ix e, Show e) => Show (Array LN ix e) Source # | |
(Ragged L ix e, Show e) => Show (Array D ix e) Source # | |
(Ragged L ix e, Show e) => Show (Array M ix e) Source # | |
(Ragged L ix e, Show e, Unbox e) => Show (Array U ix e) Source # | |
(Ragged L ix e, Show e, Prim e) => Show (Array P ix e) Source # | |
(Ragged L ix e, Show e, Storable e) => Show (Array S ix e) Source # | |
Show e => Show (Array DS Ix1 e) Source # | |
(Ragged L ix e, Show e, NFData e) => Show (Array N ix e) Source # | |
(Ragged L ix e, Show e) => Show (Array B ix e) Source # | |
(Ragged L ix e, Load DW ix e, Show e) => Show (Array DW ix e) Source # | |
(Ragged L ix e, Show e) => Show (Array DI ix e) Source # | |
Semigroup (Array DL Ix1 e) Source # | |
Semigroup (Array DS Ix1 e) Source # | |
Monoid (Array DL Ix1 e) Source # | |
Monoid (Array DS Ix1 e) Source # | |
NFData ix => NFData (Array U ix e) Source # | |
Defined in Data.Massiv.Array.Manifest.Unboxed | |
Index ix => NFData (Array P ix e) Source # | |
Defined in Data.Massiv.Array.Manifest.Primitive | |
NFData ix => NFData (Array S ix e) Source # | |
Defined in Data.Massiv.Array.Manifest.Storable | |
(Index ix, NFData e) => NFData (Array N ix e) Source # | |
Defined in Data.Massiv.Array.Manifest.Boxed | |
(Index ix, NFData e) => NFData (Array B ix e) Source # | |
Defined in Data.Massiv.Array.Manifest.Boxed | |
data Array DL ix e Source # | |
data Array L ix e Source # | |
newtype Array LN ix e Source # | |
data Array D ix e Source # | |
data Array M ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Internal | |
data Array U ix e Source # | |
data Array P ix e Source # | |
data Array S ix e Source # | |
newtype Array N ix e Source # | |
data Array B ix e Source # | |
data Array DW ix e Source # | |
newtype Array DI ix e Source # | |
newtype Array DS Ix1 e Source # | |
type Item (Array L ix e) Source # | |
Defined in Data.Massiv.Core.List | |
type Item (Array LN ix e) Source # | |
Defined in Data.Massiv.Core.List | |
type Item (Array U ix e) Source # | |
type Item (Array P ix e) Source # | |
type Item (Array S ix e) Source # | |
type Item (Array DS Ix1 e) Source # | |
Defined in Data.Massiv.Array.Delayed.Stream | |
type Item (Array N ix e) Source # | |
type Item (Array B ix e) Source # | |
type Vector r e = Array r Ix1 e Source #
Type synonym for a single dimension array, or simply a flat vector.
Since: 0.5.0
type MVector s r e = MArray s r Ix1 e Source #
Type synonym for a single dimension mutable array, or simply a flat mutable vector.
Since: 0.5.0
type Matrix r e = Array r Ix2 e Source #
Type synonym for a two-dimentsional array, or simply a matrix.
Since: 0.5.0
type MMatrix s r e = MArray s r Ix2 e Source #
Type synonym for a two-dimentsional mutable array, or simply a mutable matrix.
Since: 0.5.0
class (Typeable r, Index ix) => Construct r ix e Source #
Array types that can be constructed.
Instances
Index ix => Construct DL ix e Source # | |
(Index ix, Ragged L ix e, Ragged L (Lower ix) e, Elt L ix e ~ Array L (Lower ix) e) => Construct L ix e Source # | |
Construct L Ix1 e Source # | |
Construct LN Ix1 e Source # | |
Index ix => Construct D ix e Source # | |
(Unbox e, Index ix) => Construct U ix e Source # | |
(Prim e, Index ix) => Construct P ix e Source # | |
(Storable e, Index ix) => Construct S ix e Source # | |
Construct DS Ix1 e Source # | |
(Index ix, NFData e) => Construct N ix e Source # | |
Index ix => Construct B ix e Source # | |
Index ix => Construct DW ix e Source # | |
Index ix => Construct DI ix e Source # | |
class (Typeable r, Index ix) => Load r ix e where Source #
Any array that can be computed and loaded into memory
:: Monad m | |
=> Scheduler m () | |
-> Array r ix e | Array that is being loaded |
-> (Int -> e -> m ()) | Function that writes an element into target array |
-> m () |
Load an array into memory.
Since: 0.3.0
defaultElement :: Array r ix e -> Maybe e Source #
Instances
class Load r ix e => Stream r ix e where Source #
toStream :: Array r ix e -> Steps Id e Source #
toStreamIx :: Array r ix e -> Steps Id (ix, e) Source #
Instances
Stream L Ix1 e Source # | |
Stream LN Ix1 e Source # | |
Index ix => Stream D ix e Source # | |
Index ix => Stream M ix e Source # | |
(Index ix, Unbox e) => Stream U ix e Source # | |
(Prim e, Index ix) => Stream P ix e Source # | |
(Index ix, Storable e) => Stream S ix e Source # | |
Stream DS Ix1 e Source # | |
(Index ix, NFData e) => Stream N ix e Source # | |
Index ix => Stream B ix e Source # | |
class Load r ix e => Source r ix e Source #
Arrays that can be used as source to practically any manipulation function.
Instances
Index ix => Source D ix e Source # | |
Index ix => Source M ix e Source # | |
(Unbox e, Index ix) => Source U ix e Source # | |
(Prim e, Index ix) => Source P ix e Source # | |
(Storable e, Index ix) => Source S ix e Source # | |
(Index ix, NFData e) => Source N ix e Source # | |
Index ix => Source B ix e Source # | |
class Index ix => Resize r ix Source #
Instances
Index ix => Resize DL ix Source # | |
Defined in Data.Massiv.Array.Delayed.Push | |
Index ix => Resize D ix Source # | |
Defined in Data.Massiv.Array.Delayed.Pull | |
Index ix => Resize M ix Source # | |
Defined in Data.Massiv.Array.Manifest.Internal | |
Index ix => Resize U ix Source # | |
Defined in Data.Massiv.Array.Manifest.Unboxed | |
Index ix => Resize P ix Source # | |
Defined in Data.Massiv.Array.Manifest.Primitive | |
Index ix => Resize S ix Source # | |
Defined in Data.Massiv.Array.Manifest.Storable | |
Index ix => Resize N ix Source # | |
Defined in Data.Massiv.Array.Manifest.Boxed | |
Index ix => Resize B ix Source # | |
Defined in Data.Massiv.Array.Manifest.Boxed | |
Index ix => Resize DI ix Source # | |
Defined in Data.Massiv.Array.Delayed.Interleaved |
class Load r ix e => Extract r ix e Source #
Instances
Index ix => Extract D ix e Source # | |
Defined in Data.Massiv.Array.Delayed.Pull | |
Index ix => Extract M ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Internal | |
(Unbox e, Index ix) => Extract U ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Unboxed | |
(Prim e, Index ix) => Extract P ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Primitive | |
(Storable e, Index ix) => Extract S ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Storable | |
Extract DS Ix1 e Source # | |
(Index ix, NFData e) => Extract N ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Boxed | |
Index ix => Extract B ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Boxed | |
Index ix => Extract DI ix e Source # | |
Defined in Data.Massiv.Array.Delayed.Interleaved |
class Load r ix e => StrideLoad r ix e where Source #
Nothing
:: Monad m | |
=> Scheduler m () | |
-> Stride ix | Stride to use |
-> Sz ix | Size of the target array affected by the stride. |
-> Array r ix e | Array that is being loaded |
-> (Int -> e -> m ()) | Function that writes an element into target array |
-> m () |
Load an array into memory with stride. Default implementation requires an instance of
Source
.
:: (Source r ix e, Monad m) | |
=> Scheduler m () | |
-> Stride ix | Stride to use |
-> Sz ix | Size of the target array affected by the stride. |
-> Array r ix e | Array that is being loaded |
-> (Int -> e -> m ()) | Function that writes an element into target array |
-> m () |
Load an array into memory with stride. Default implementation requires an instance of
Source
.
Instances
Index ix => StrideLoad D ix e Source # | |
Index ix => StrideLoad M ix e Source # | |
(Unbox e, Index ix) => StrideLoad U ix e Source # | |
(Prim e, Index ix) => StrideLoad P ix e Source # | |
(Index ix, Storable e) => StrideLoad S ix e Source # | |
(Index ix, NFData e) => StrideLoad N ix e Source # | |
Index ix => StrideLoad B ix e Source # | |
StrideLoad DW Ix1 e Source # | |
StrideLoad DW Ix2 e Source # | |
StrideLoad DW Ix5T e Source # | |
StrideLoad DW Ix4T e Source # | |
StrideLoad DW Ix3T e Source # | |
StrideLoad DW Ix2T e Source # | |
Index ix => StrideLoad DI ix e Source # | |
(Index (IxN n), StrideLoad DW (Ix (n - 1)) e) => StrideLoad DW (IxN n) e Source # | |
class Load r ix e => Slice r ix e Source #
Instances
class Load r ix e => OuterSlice r ix e Source #
Instances
class Load r ix e => InnerSlice r ix e Source #
Instances
(Elt D ix e ~ Array D (Lower ix) e, Index ix) => InnerSlice D ix e Source # | |
(Elt M ix e ~ Array M (Lower ix) e, Index ix, Index (Lower ix)) => InnerSlice M ix e Source # | |
InnerSlice M Ix1 e Source # | |
(Unbox e, Index ix, Index (Lower ix), Elt U ix e ~ Elt M ix e, Elt M ix e ~ Array M (Lower ix) e) => InnerSlice U ix e Source # | |
Unbox e => InnerSlice U Ix1 e Source # | |
(Prim e, Index ix, Index (Lower ix), Elt M ix e ~ Array M (Lower ix) e, Elt P ix e ~ Array M (Lower ix) e) => InnerSlice P ix e Source # | |
Prim e => InnerSlice P Ix1 e Source # | |
(Storable e, Index ix, Index (Lower ix), Elt M ix e ~ Array M (Lower ix) e, Elt S ix e ~ Array M (Lower ix) e) => InnerSlice S ix e Source # | |
(NFData e, Index ix, Index (Lower ix), Elt M ix e ~ Array M (Lower ix) e, Elt N ix e ~ Array M (Lower ix) e) => InnerSlice N ix e Source # | |
(Index ix, Index (Lower ix), Elt M ix e ~ Array M (Lower ix) e, Elt B ix e ~ Array M (Lower ix) e) => InnerSlice B ix e Source # | |
class (Load r ix e, Source r ix e) => Manifest r ix e Source #
Manifest arrays are backed by actual memory and values are looked up versus
computed as it is with delayed arrays. Because of this fact indexing functions
(
, !
)(
, etc. are constrained to manifest arrays only.!?
)
Instances
Index ix => Manifest M ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Internal | |
(Unbox e, Index ix) => Manifest U ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Unboxed | |
(Index ix, Prim e) => Manifest P ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Primitive | |
(Index ix, Storable e) => Manifest S ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Storable | |
(Index ix, NFData e) => Manifest N ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Boxed | |
Index ix => Manifest B ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Boxed |
class (Construct r ix e, Manifest r ix e) => Mutable r ix e Source #
Instances
class Construct r ix e => Ragged r ix e Source #
emptyR, isNull, consR, unconsR, generateRaggedM, edgeSize, flattenRagged, loadRagged, raggedFormat
Instances
class Nested r ix e where Source #
fromNested :: NestedStruct r ix e -> Array r ix e Source #
toNested :: Array r ix e -> NestedStruct r ix e Source #
Instances
Nested L ix e Source # | |
Defined in Data.Massiv.Core.List fromNested :: NestedStruct L ix e -> Array L ix e Source # | |
(Elt LN ix e ~ Array LN (Lower ix) e, ListItem ix e ~ [ListItem (Lower ix) e], Coercible (Elt LN ix e) (ListItem ix e)) => Nested LN ix e Source # | |
Defined in Data.Massiv.Core.List fromNested :: NestedStruct LN ix e -> Array LN ix e Source # | |
Nested LN Ix1 e Source # | |
Defined in Data.Massiv.Core.List |
type family NestedStruct r ix e :: * Source #
Instances
type NestedStruct L ix e Source # | |
Defined in Data.Massiv.Core.List | |
type NestedStruct LN ix e Source # | |
Defined in Data.Massiv.Core.List |
Instances
Instances
Computation strategy to use when scheduling work.
Seq | Sequential computation |
ParOn ![Int] | Schedule workers to run on specific capabilities. Specifying an empty list |
ParN !Word16 | Specify the number of workers that will be handling all the jobs. Difference from |
pattern Par :: Comp | Parallel computation using all available cores. Same as Since: scheduler-1.0.0 |
pattern Par' :: Comp | Parallel computation using all available cores. Same as Since: scheduler-1.1.0 |
data WorkerStates s #
Each worker is capable of keeping it's own state, that can be share for different
schedulers, but not at the same time. In other words using the same WorkerStates
on
withSchedulerS
concurrently will result in an error. Can be initialized with
initWorkerStates
Since: scheduler-1.4.0
initWorkerStates :: MonadIO m => Comp -> (WorkerId -> m s) -> m (WorkerStates s) #
Initialize a separate state for each worker.
Since: scheduler-1.4.0
module Data.Massiv.Core.Index
Exceptions
class Monad m => MonadThrow (m :: Type -> Type) where #
A class for monads in which exceptions may be thrown.
Instances should obey the following law:
throwM e >> x = throwM e
In other words, throwing an exception short-circuits the rest of the monadic computation.
throwM :: Exception e => e -> m a #
Throw an exception. Note that this throws when this action is run in
the monad m
, not when it is applied. It is a generalization of
Control.Exception's throwIO
.
Should satisfy the law:
throwM e >> f = throwM e
Instances
throw :: Exception e => e -> a #
Throw an exception. Exceptions may be thrown from purely
functional code, but may only be caught within the IO
monad.
class (Typeable e, Show e) => Exception e where #
Any type that you wish to throw or catch as an exception must be an
instance of the Exception
class. The simplest case is a new exception
type directly below the root:
data MyException = ThisException | ThatException deriving Show instance Exception MyException
The default method definitions in the Exception
class do what we need
in this case. You can now throw and catch ThisException
and
ThatException
as exceptions:
*Main> throw ThisException `catch` \e -> putStrLn ("Caught " ++ show (e :: MyException)) Caught ThisException
In more complicated examples, you may wish to define a whole hierarchy of exceptions:
--------------------------------------------------------------------- -- Make the root exception type for all the exceptions in a compiler data SomeCompilerException = forall e . Exception e => SomeCompilerException e instance Show SomeCompilerException where show (SomeCompilerException e) = show e instance Exception SomeCompilerException compilerExceptionToException :: Exception e => e -> SomeException compilerExceptionToException = toException . SomeCompilerException compilerExceptionFromException :: Exception e => SomeException -> Maybe e compilerExceptionFromException x = do SomeCompilerException a <- fromException x cast a --------------------------------------------------------------------- -- Make a subhierarchy for exceptions in the frontend of the compiler data SomeFrontendException = forall e . Exception e => SomeFrontendException e instance Show SomeFrontendException where show (SomeFrontendException e) = show e instance Exception SomeFrontendException where toException = compilerExceptionToException fromException = compilerExceptionFromException frontendExceptionToException :: Exception e => e -> SomeException frontendExceptionToException = toException . SomeFrontendException frontendExceptionFromException :: Exception e => SomeException -> Maybe e frontendExceptionFromException x = do SomeFrontendException a <- fromException x cast a --------------------------------------------------------------------- -- Make an exception type for a particular frontend compiler exception data MismatchedParentheses = MismatchedParentheses deriving Show instance Exception MismatchedParentheses where toException = frontendExceptionToException fromException = frontendExceptionFromException
We can now catch a MismatchedParentheses
exception as
MismatchedParentheses
, SomeFrontendException
or
SomeCompilerException
, but not other types, e.g. IOException
:
*Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: MismatchedParentheses)) Caught MismatchedParentheses *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: SomeFrontendException)) Caught MismatchedParentheses *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: SomeCompilerException)) Caught MismatchedParentheses *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: IOException)) *** Exception: MismatchedParentheses
Nothing
toException :: e -> SomeException #
fromException :: SomeException -> Maybe e #
displayException :: e -> String #
Render this exception value in a human-friendly manner.
Default implementation:
.show
Since: base-4.8.0.0
Instances
data SomeException #
The SomeException
type is the root of the exception type hierarchy.
When an exception of type e
is thrown, behind the scenes it is
encapsulated in a SomeException
.
Instances
Show SomeException | Since: base-3.0 |
Defined in GHC.Exception.Type showsPrec :: Int -> SomeException -> ShowS # show :: SomeException -> String # showList :: [SomeException] -> ShowS # | |
Exception SomeException | Since: base-3.0 |
Defined in GHC.Exception.Type |
data IndexException where Source #
Exceptions that get thrown when there is a problem with an index, size or dimension.
Since: 0.3.0
IndexZeroException :: Index ix => !ix -> IndexException | Index contains a zero value along one of the dimensions. |
IndexDimensionException :: (NFData ix, Show ix, Typeable ix) => !ix -> !Dim -> IndexException | Dimension is out of reach. |
IndexOutOfBoundsException :: Index ix => !(Sz ix) -> !ix -> IndexException | Index is out of bounds. |
Instances
Eq IndexException Source # | |
Defined in Data.Massiv.Core.Index.Internal (==) :: IndexException -> IndexException -> Bool # (/=) :: IndexException -> IndexException -> Bool # | |
Show IndexException Source # | |
Defined in Data.Massiv.Core.Index.Internal showsPrec :: Int -> IndexException -> ShowS # show :: IndexException -> String # showList :: [IndexException] -> ShowS # | |
Exception IndexException Source # | |
Defined in Data.Massiv.Core.Index.Internal | |
NFData IndexException Source # | |
Defined in Data.Massiv.Core.Index.Internal rnf :: IndexException -> () # |
data SizeException where Source #
Exception that indicates an issue with an array size.
Since: 0.3.0
SizeMismatchException :: Index ix => !(Sz ix) -> !(Sz ix) -> SizeException | Two sizes are expected to be equal along some or all dimensions, but they are not. |
SizeElementsMismatchException :: (Index ix, Index ix') => !(Sz ix) -> !(Sz ix') -> SizeException | Total number of elements does not match between the two sizes. |
SizeSubregionException :: Index ix => !(Sz ix) -> !ix -> !(Sz ix) -> SizeException | Described subregion is too big for the specified size. |
SizeEmptyException :: Index ix => !(Sz ix) -> SizeException | An array with the size cannot contain any elements. |
Instances
Eq SizeException Source # | |
Defined in Data.Massiv.Core.Index.Internal (==) :: SizeException -> SizeException -> Bool # (/=) :: SizeException -> SizeException -> Bool # | |
Show SizeException Source # | |
Defined in Data.Massiv.Core.Index.Internal showsPrec :: Int -> SizeException -> ShowS # show :: SizeException -> String # showList :: [SizeException] -> ShowS # | |
Exception SizeException Source # | |
Defined in Data.Massiv.Core.Index.Internal | |
NFData SizeException Source # | |
Defined in Data.Massiv.Core.Index.Internal rnf :: SizeException -> () # |
data ShapeException Source #
Exception that can happen upon conversion of a ragged type array into the rectangular kind. Which means conversion from lists is susceptible to this exception.
Since: 0.3.0
Instances
Eq ShapeException Source # | |
Defined in Data.Massiv.Core.Index.Internal (==) :: ShapeException -> ShapeException -> Bool # (/=) :: ShapeException -> ShapeException -> Bool # | |
Show ShapeException Source # | |
Defined in Data.Massiv.Core.Index.Internal showsPrec :: Int -> ShapeException -> ShowS # show :: ShapeException -> String # showList :: [ShapeException] -> ShowS # | |
Exception ShapeException Source # | |
Defined in Data.Massiv.Core.Index.Internal |
newtype ImpossibleException Source #
Instances
Show ImpossibleException Source # | |
Defined in Data.Massiv.Core.Exception showsPrec :: Int -> ImpossibleException -> ShowS # show :: ImpossibleException -> String # showList :: [ImpossibleException] -> ShowS # | |
Exception ImpossibleException Source # | |
throwImpossible :: Exception e => e -> a Source #
data Uninitialized Source #
An error that gets thrown when an unitialized element of a boxed array gets accessed. Can only
happen when array was constructed with unsafeNew
.
Instances
Show Uninitialized Source # | |
Defined in Data.Massiv.Core.Exception showsPrec :: Int -> Uninitialized -> ShowS # show :: Uninitialized -> String # showList :: [Uninitialized] -> ShowS # | |
Exception Uninitialized Source # | |
Defined in Data.Massiv.Core.Exception |
guardNumberOfElements :: (MonadThrow m, Index ix, Index ix') => Sz ix -> Sz ix' -> m () Source #
Throw SizeElementsMismatchException
whenever number of elements in both sizes do
not match.
Since: 0.3.5
Stateful Monads
class MonadIO m => MonadUnliftIO (m :: Type -> Type) #
Monads which allow their actions to be run in IO
.
While MonadIO
allows an IO
action to be lifted into another
monad, this class captures the opposite concept: allowing you to
capture the monadic context. Note that, in order to meet the laws
given below, the intuition is that a monad must have no monadic
state, but may have monadic context. This essentially limits
MonadUnliftIO
to ReaderT
and IdentityT
transformers on top of
IO
.
Laws. For any value u
returned by askUnliftIO
, it must meet the
monad transformer laws as reformulated for MonadUnliftIO
:
unliftIO u . return = return
unliftIO u (m >>= f) = unliftIO u m >>= unliftIO u . f
Instances of MonadUnliftIO
must also satisfy the idempotency law:
askUnliftIO >>= \u -> (liftIO . unliftIO u) m = m
This law showcases two properties. First, askUnliftIO
doesn't change
the monadic context, and second, liftIO . unliftIO u
is equivalent to
id
IF called in the same monadic context as askUnliftIO
.
Since: unliftio-core-0.1.0.0
Instances
MonadUnliftIO IO | |
Defined in Control.Monad.IO.Unlift | |
MonadUnliftIO m => MonadUnliftIO (IdentityT m) | |
Defined in Control.Monad.IO.Unlift | |
MonadUnliftIO m => MonadUnliftIO (ReaderT r m) | |
Defined in Control.Monad.IO.Unlift |
class Monad m => MonadIO (m :: Type -> Type) where #
Monads in which IO
computations may be embedded.
Any monad built by applying a sequence of monad transformers to the
IO
monad will be an instance of this class.
Instances should satisfy the following laws, which state that liftIO
is a transformer of monads:
Instances
class Monad m => PrimMonad (m :: Type -> Type) #
Class of monads which can perform primitive state-transformer actions
Instances
PrimMonad IO | |
PrimMonad (ST s) | |
PrimMonad m => PrimMonad (MaybeT m) | |
PrimMonad m => PrimMonad (ListT m) | |
PrimMonad m => PrimMonad (ExceptT e m) | |
PrimMonad m => PrimMonad (IdentityT m) | |
(Error e, PrimMonad m) => PrimMonad (ErrorT e m) | |
PrimMonad m => PrimMonad (StateT s m) | |
PrimMonad m => PrimMonad (StateT s m) | |
(Monoid w, PrimMonad m) => PrimMonad (WriterT w m) | |
(Monoid w, PrimMonad m) => PrimMonad (WriterT w m) | |
(Monoid w, PrimMonad m) => PrimMonad (AccumT w m) | Since: primitive-0.6.3.0 |
PrimMonad m => PrimMonad (SelectT r m) | |
PrimMonad m => PrimMonad (ContT r m) | Since: primitive-0.6.3.0 |
PrimMonad m => PrimMonad (ReaderT r m) | |
(Monoid w, PrimMonad m) => PrimMonad (RWST r w s m) | |
(Monoid w, PrimMonad m) => PrimMonad (RWST r w s m) | |