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 family Elt r ix e :: * where ...
- type family EltRepr r ix :: *
- class (Typeable r, Index ix) => Construct r ix e
- class (Typeable r, Index ix) => Load r ix e where
- loadArrayM :: Monad m => Scheduler m () -> Array r ix e -> (Int -> e -> m ()) -> m ()
- 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 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
- 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 :: (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 fasion, depth of which is controlled by
.Rank
ix
Instances
Functor (Array DL ix) Source # | |
Functor (Array D ix) 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 | |
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 # | |
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 # | |
(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 # | |
(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 # | |
(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 # | |
(Storable e, Eq e, Index ix) => Eq (Array S ix e) Source # | |
(Prim e, Eq e, Index ix) => Eq (Array P 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 | |
(Storable e, Ord e, Index ix) => Ord (Array S ix e) Source # | |
Defined in Data.Massiv.Array.Manifest.Storable | |
(Prim e, Ord e, Index ix) => Ord (Array P ix e) Source # | |
Defined in Data.Massiv.Array.Manifest.Primitive | |
(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, Storable e) => Show (Array S ix e) Source # | |
(Ragged L ix e, Show e, Prim e) => Show (Array P ix 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 # | |
Monoid (Array DL Ix1 e) Source # | |
NFData ix => NFData (Array U ix e) Source # | |
Defined in Data.Massiv.Array.Manifest.Unboxed | |
NFData ix => NFData (Array S ix e) Source # | |
Defined in Data.Massiv.Array.Manifest.Storable | |
Index ix => NFData (Array P ix e) Source # | |
Defined in Data.Massiv.Array.Manifest.Primitive | |
(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 S ix e Source # | |
data Array P 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 # | |
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 S ix e) Source # | |
type Item (Array P ix e) Source # | |
type Item (Array N ix e) Source # | |
type Item (Array B ix e) Source # | |
type family EltRepr r ix :: * Source #
Instances
type EltRepr DL ix Source # | |
Defined in Data.Massiv.Array.Delayed.Push | |
type EltRepr L ix Source # | |
Defined in Data.Massiv.Core.List | |
type EltRepr LN ix Source # | |
Defined in Data.Massiv.Core.List | |
type EltRepr D ix Source # | |
Defined in Data.Massiv.Array.Delayed.Pull | |
type EltRepr M ix Source # | |
Defined in Data.Massiv.Array.Manifest.Internal | |
type EltRepr U ix Source # | |
Defined in Data.Massiv.Array.Manifest.Unboxed | |
type EltRepr S ix Source # | |
Defined in Data.Massiv.Array.Manifest.Storable | |
type EltRepr P ix Source # | |
Defined in Data.Massiv.Array.Manifest.Primitive | |
type EltRepr N ix Source # | |
Defined in Data.Massiv.Array.Manifest.Boxed | |
type EltRepr B ix Source # | |
Defined in Data.Massiv.Array.Manifest.Boxed | |
type EltRepr DW ix Source # | |
Defined in Data.Massiv.Array.Delayed.Windowed | |
type EltRepr DI ix Source # | |
Defined in Data.Massiv.Array.Delayed.Interleaved |
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 # | |
Index ix => Construct D ix e Source # | |
Index ix => Construct M ix e Source # | |
(Unbox e, Index ix) => Construct U ix e Source # | |
(Storable e, Index ix) => Construct S ix e Source # | |
(Prim e, Index ix) => Construct P ix 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.
Instances
Index ix => Load DL ix e Source # | |
(Index ix, Ragged L ix e) => Load L ix e Source # | |
Index ix => Load D ix e Source # | |
Index ix => Load M ix e Source # | |
(Unbox e, Index ix) => Load U ix e Source # | |
(Index ix, Storable e) => Load S ix e Source # | |
(Prim e, Index ix) => Load P ix e Source # | |
(Index ix, NFData e) => Load N ix e Source # | |
Index ix => Load B ix e Source # | |
Load DW Ix1 e Source # | |
Load DW Ix2 e Source # | |
Load DW Ix5T e Source # | |
Load DW Ix4T e Source # | |
Load DW Ix3T e Source # | |
Load DW Ix2T e Source # | |
Index ix => Load DI ix e Source # | |
(Index (IxN n), Load DW (Ix (n - 1)) e) => Load DW (IxN n) 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 # | |
Defined in Data.Massiv.Array.Delayed.Pull | |
Index ix => Source M ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Internal | |
(Unbox e, Index ix) => Source U ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Unboxed | |
(Storable e, Index ix) => Source S ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Storable | |
(Prim e, Index ix) => Source P ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Primitive | |
(Index ix, NFData e) => Source N ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Boxed | |
Index ix => Source B ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Boxed |
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 S ix Source # | |
Defined in Data.Massiv.Array.Manifest.Storable | |
Index ix => Resize P ix Source # | |
Defined in Data.Massiv.Array.Manifest.Primitive | |
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 | |
(Storable e, Index ix) => Extract S ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Storable | |
(Prim e, Index ix) => Extract P ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Primitive | |
(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 # | |
(Index ix, Storable e) => StrideLoad S ix e Source # | |
(Prim e, Index ix) => StrideLoad P 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 # | |
(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 # | |
(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 # | |
(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, Storable e) => Manifest S ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Storable | |
(Index ix, Prim e) => Manifest P ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Primitive | |
(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 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
(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 | |
Nested LN ix e => IsList (Array LN ix e) Source # | |
(Ragged L ix e, Show e) => Show (Array LN ix e) Source # | |
newtype Array LN ix e Source # | |
type EltRepr LN ix Source # | |
Defined in Data.Massiv.Core.List | |
type NestedStruct LN ix e Source # | |
Defined in Data.Massiv.Core.List | |
type Item (Array LN ix e) Source # | |
Defined in Data.Massiv.Core.List |
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 |
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 :: (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
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 |
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
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 |
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 #
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
The third is a currently nameless law which ensures that the current context is preserved.
askUnliftIO >>= (u -> liftIO (unliftIO u m)) = m
If you have a name for this, please submit it in a pull request for great glory.
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) | |