massiv-1.0.4.0: Massiv (Массив) is an Array Library.
Copyright(c) Alexey Kuleshevich 2018-2022
LicenseBSD3
MaintainerAlexey Kuleshevich <lehins@yandex.ru>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Massiv.Core

Description

 
Synopsis

Documentation

data family Array r ix e :: Type Source #

The array family. Representations r describe how data is arranged or computed. All arrays have a common property that each index ix always maps to the same unique element e, even if that element does not yet exist in memory and the array has to be computed in order to get the value of that element. Data is always arranged in a nested row-major fashion. Rank of an array is specified by Dimensions ix.

Since: 0.1.0

Instances

Instances details
Index ix => Foldable (Array DI ix) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Interleaved

Methods

fold :: Monoid m => Array DI ix m -> m #

foldMap :: Monoid m => (a -> m) -> Array DI ix a -> 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 #

sum :: Num a => Array DI ix a -> a #

product :: Num a => Array DI ix a -> a #

Index ix => Foldable (Array D ix) Source #

Row-major sequential folding over a Delayed array.

Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

fold :: Monoid m => Array D ix m -> m #

foldMap :: Monoid m => (a -> m) -> Array D ix a -> 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 #

sum :: Num a => Array D ix a -> a #

product :: Num a => Array D ix a -> a #

Foldable (Array DS Ix1) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Stream

Methods

fold :: Monoid m => Array DS Ix1 m -> m #

foldMap :: Monoid m => (a -> m) -> Array DS Ix1 a -> 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 #

sum :: Num a => Array DS Ix1 a -> a #

product :: Num a => Array DS Ix1 a -> a #

Index ix => Foldable (Array B ix) Source #

Row-major sequential folding over a Boxed array.

Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

fold :: Monoid m => Array B ix m -> m #

foldMap :: Monoid m => (a -> m) -> Array B ix a -> 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 #

sum :: Num a => Array B ix a -> a #

product :: Num a => Array B ix a -> a #

Index ix => Foldable (Array BL ix) Source #

Row-major sequential folding over a Boxed array.

Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

fold :: Monoid m => Array BL ix m -> m #

foldMap :: Monoid m => (a -> m) -> Array BL ix a -> m #

foldMap' :: Monoid m => (a -> m) -> Array BL ix a -> m #

foldr :: (a -> b -> b) -> b -> Array BL ix a -> b #

foldr' :: (a -> b -> b) -> b -> Array BL ix a -> b #

foldl :: (b -> a -> b) -> b -> Array BL ix a -> b #

foldl' :: (b -> a -> b) -> b -> Array BL ix a -> b #

foldr1 :: (a -> a -> a) -> Array BL ix a -> a #

foldl1 :: (a -> a -> a) -> Array BL ix a -> a #

toList :: Array BL ix a -> [a] #

null :: Array BL ix a -> Bool #

length :: Array BL ix a -> Int #

elem :: Eq a => a -> Array BL ix a -> Bool #

maximum :: Ord a => Array BL ix a -> a #

minimum :: Ord a => Array BL ix a -> a #

sum :: Num a => Array BL ix a -> a #

product :: Num a => Array BL ix a -> a #

Index ix => Traversable (Array B ix) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

traverse :: Applicative f => (a -> f b) -> Array B ix a -> f (Array B ix b) #

sequenceA :: Applicative f => Array B ix (f a) -> f (Array B ix a) #

mapM :: Monad m => (a -> m b) -> Array B ix a -> m (Array B ix b) #

sequence :: Monad m => Array B ix (m a) -> m (Array B ix a) #

Index ix => Traversable (Array BL ix) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

traverse :: Applicative f => (a -> f b) -> Array BL ix a -> f (Array BL ix b) #

sequenceA :: Applicative f => Array BL ix (f a) -> f (Array BL ix a) #

mapM :: Monad m => (a -> m b) -> Array BL ix a -> m (Array BL ix b) #

sequence :: Monad m => Array BL ix (m a) -> m (Array BL ix a) #

Index ix => Applicative (Array DI ix) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Interleaved

Methods

pure :: a -> Array DI ix a #

(<*>) :: Array DI ix (a -> b) -> Array DI ix a -> Array DI ix b #

liftA2 :: (a -> b -> c) -> Array DI ix a -> Array DI ix b -> Array DI ix c #

(*>) :: Array DI ix a -> Array DI ix b -> Array DI ix b #

(<*) :: Array DI ix a -> Array DI ix b -> Array DI ix a #

Index ix => Applicative (Array D ix) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

pure :: a -> Array D ix a #

(<*>) :: Array D ix (a -> b) -> Array D ix a -> Array D ix b #

liftA2 :: (a -> b -> c) -> Array D ix a -> Array D ix b -> Array D ix c #

(*>) :: Array D ix a -> Array D ix b -> Array D ix b #

(<*) :: Array D ix a -> Array D ix b -> Array D ix a #

Applicative (Array DS Ix1) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Stream

Methods

pure :: a -> Array DS Ix1 a #

(<*>) :: Array DS Ix1 (a -> b) -> Array DS Ix1 a -> Array DS Ix1 b #

liftA2 :: (a -> b -> c) -> Array DS Ix1 a -> Array DS Ix1 b -> Array DS Ix1 c #

(*>) :: Array DS Ix1 a -> Array DS Ix1 b -> Array DS Ix1 b #

(<*) :: Array DS Ix1 a -> Array DS Ix1 b -> Array DS Ix1 a #

Functor (Array DI ix) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Interleaved

Methods

fmap :: (a -> b) -> Array DI ix a -> Array DI ix b #

(<$) :: a -> Array DI ix b -> Array DI ix a #

Functor (Array D ix) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

fmap :: (a -> b) -> Array D ix a -> Array D ix b #

(<$) :: a -> Array D ix b -> Array D ix a #

Index ix => Functor (Array DL ix) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Push

Methods

fmap :: (a -> b) -> Array DL ix a -> Array DL ix b #

(<$) :: a -> Array DL ix b -> Array DL ix a #

Functor (Array DS Ix1) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Stream

Methods

fmap :: (a -> b) -> Array DS Ix1 a -> Array DS Ix1 b #

(<$) :: a -> Array DS Ix1 b -> Array DS Ix1 a #

Functor (Array DW ix) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Windowed

Methods

fmap :: (a -> b) -> Array DW ix a -> Array DW ix b #

(<$) :: a -> Array DW ix b -> Array DW ix a #

Index ix => Functor (Array B ix) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

fmap :: (a -> b) -> Array B ix a -> Array B ix b #

(<$) :: a -> Array B ix b -> Array B ix a #

Index ix => Functor (Array BL ix) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

fmap :: (a -> b) -> Array BL ix a -> Array BL ix b #

(<$) :: a -> Array BL ix b -> Array BL ix a #

Monad (Array DS Ix1) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Stream

Methods

(>>=) :: Array DS Ix1 a -> (a -> Array DS Ix1 b) -> Array DS Ix1 b #

(>>) :: Array DS Ix1 a -> Array DS Ix1 b -> Array DS Ix1 b #

return :: a -> Array DS Ix1 a #

Monoid (Array DL Ix1 e) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Push

Methods

mempty :: Array DL Ix1 e #

mappend :: Array DL Ix1 e -> Array DL Ix1 e -> Array DL Ix1 e #

mconcat :: [Array DL Ix1 e] -> Array DL Ix1 e #

Monoid (Array DS Ix1 e) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Stream

Methods

mempty :: Array DS Ix1 e #

mappend :: Array DS Ix1 e -> Array DS Ix1 e -> Array DS Ix1 e #

mconcat :: [Array DS Ix1 e] -> Array DS Ix1 e #

Semigroup (Array DL Ix1 e) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Push

Methods

(<>) :: Array DL Ix1 e -> Array DL Ix1 e -> Array DL Ix1 e #

sconcat :: NonEmpty (Array DL Ix1 e) -> Array DL Ix1 e #

stimes :: Integral b => b -> Array DL Ix1 e -> Array DL Ix1 e #

Semigroup (Array DS Ix1 e) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Stream

Methods

(<>) :: Array DS Ix1 e -> Array DS Ix1 e -> Array DS Ix1 e #

sconcat :: NonEmpty (Array DS Ix1 e) -> Array DS Ix1 e #

stimes :: Integral b => b -> Array DS Ix1 e -> Array DS Ix1 e #

IsList (Array DS Ix1 e) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Stream

Associated Types

type Item (Array DS Ix1 e) #

Methods

fromList :: [Item (Array DS Ix1 e)] -> Array DS Ix1 e #

fromListN :: Int -> [Item (Array DS Ix1 e)] -> Array DS Ix1 e #

toList :: Array DS Ix1 e -> [Item (Array DS Ix1 e)] #

(IsList (Array L ix e), Ragged L ix e) => IsList (Array B ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Associated Types

type Item (Array B ix e) #

Methods

fromList :: [Item (Array B ix e)] -> Array B ix e #

fromListN :: Int -> [Item (Array B ix e)] -> Array B ix e #

toList :: Array B ix e -> [Item (Array B ix e)] #

(IsList (Array L ix e), Ragged L ix e) => IsList (Array BL ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Associated Types

type Item (Array BL ix e) #

Methods

fromList :: [Item (Array BL ix e)] -> Array BL ix e #

fromListN :: Int -> [Item (Array BL ix e)] -> Array BL ix e #

toList :: Array BL ix e -> [Item (Array BL ix e)] #

(NFData e, IsList (Array L ix e), Ragged L ix e) => IsList (Array BN ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Associated Types

type Item (Array BN ix e) #

Methods

fromList :: [Item (Array BN ix e)] -> Array BN ix e #

fromListN :: Int -> [Item (Array BN ix e)] -> Array BN ix e #

toList :: Array BN ix e -> [Item (Array BN ix e)] #

(Prim e, IsList (Array L ix e), Ragged L ix e) => IsList (Array P ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Associated Types

type Item (Array P ix e) #

Methods

fromList :: [Item (Array P ix e)] -> Array P ix e #

fromListN :: Int -> [Item (Array P ix e)] -> Array P ix e #

toList :: Array P ix e -> [Item (Array P ix e)] #

(Storable e, IsList (Array L ix e), Ragged L ix e) => IsList (Array S ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Associated Types

type Item (Array S ix e) #

Methods

fromList :: [Item (Array S ix e)] -> Array S ix e #

fromListN :: Int -> [Item (Array S ix e)] -> Array S ix e #

toList :: Array S ix e -> [Item (Array S ix e)] #

(Unbox e, IsList (Array L ix e), Ragged L ix e) => IsList (Array U ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Associated Types

type Item (Array U ix e) #

Methods

fromList :: [Item (Array U ix e)] -> Array U ix e #

fromListN :: Int -> [Item (Array U ix e)] -> Array U ix e #

toList :: Array U ix e -> [Item (Array U ix e)] #

Coercible (Elt ix e) (ListItem ix e) => IsList (Array L ix e) Source # 
Instance details

Defined in Data.Massiv.Core.List

Associated Types

type Item (Array L ix e) #

Methods

fromList :: [Item (Array L ix e)] -> Array L ix e #

fromListN :: Int -> [Item (Array L ix e)] -> Array L ix e #

toList :: Array L ix e -> [Item (Array L ix e)] #

(Ragged L ix e, Show e) => Show (Array DI ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Interleaved

Methods

showsPrec :: Int -> Array DI ix e -> ShowS #

show :: Array DI ix e -> String #

showList :: [Array DI ix e] -> ShowS #

(Ragged L ix e, Show e) => Show (Array D ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

showsPrec :: Int -> Array D ix e -> ShowS #

show :: Array D ix e -> String #

showList :: [Array D ix e] -> ShowS #

(Ragged L ix e, Show e) => Show (Array DL ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

showsPrec :: Int -> Array DL ix e -> ShowS #

show :: Array DL ix e -> String #

showList :: [Array DL ix e] -> ShowS #

Show e => Show (Array DS Ix1 e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

showsPrec :: Int -> Array DS Ix1 e -> ShowS #

show :: Array DS Ix1 e -> String #

showList :: [Array DS Ix1 e] -> ShowS #

(Ragged L ix e, Load DW ix e, Show e) => Show (Array DW ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Windowed

Methods

showsPrec :: Int -> Array DW ix e -> ShowS #

show :: Array DW ix e -> String #

showList :: [Array DW ix e] -> ShowS #

(Ragged L ix e, Show e) => Show (Array B ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

showsPrec :: Int -> Array B ix e -> ShowS #

show :: Array B ix e -> String #

showList :: [Array B ix e] -> ShowS #

(Ragged L ix e, Show e) => Show (Array BL ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

showsPrec :: Int -> Array BL ix e -> ShowS #

show :: Array BL ix e -> String #

showList :: [Array BL ix e] -> ShowS #

(Ragged L ix e, Show e, NFData e) => Show (Array BN ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

showsPrec :: Int -> Array BN ix e -> ShowS #

show :: Array BN ix e -> String #

showList :: [Array BN ix e] -> ShowS #

(Ragged L ix e, Show e, Prim e) => Show (Array P ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

showsPrec :: Int -> Array P ix e -> ShowS #

show :: Array P ix e -> String #

showList :: [Array P ix e] -> ShowS #

(Ragged L ix e, Show e, Storable e) => Show (Array S ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

showsPrec :: Int -> Array S ix e -> ShowS #

show :: Array S ix e -> String #

showList :: [Array S ix e] -> ShowS #

(Ragged L ix e, Show e, Unbox e) => Show (Array U ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

showsPrec :: Int -> Array U ix e -> ShowS #

show :: Array U ix e -> String #

showList :: [Array U ix e] -> ShowS #

(Ragged L ix e, Show e) => Show (Array L ix e) Source # 
Instance details

Defined in Data.Massiv.Core.List

Methods

showsPrec :: Int -> Array L ix e -> ShowS #

show :: Array L ix e -> String #

showList :: [Array L ix e] -> ShowS #

(Index ix, NFData e) => NFData (Array B ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

rnf :: Array B ix e -> () #

(Index ix, NFData e) => NFData (Array BL ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

rnf :: Array BL ix e -> () #

NFData (Array BN ix e) Source #

O(1) - BN is already in normal form

Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

rnf :: Array BN ix e -> () #

Index ix => NFData (Array P ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

rnf :: Array P ix e -> () #

NFData ix => NFData (Array S ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

rnf :: Array S ix e -> () #

NFData ix => NFData (Array U ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

rnf :: Array U ix e -> () #

(Index ix, Eq e) => Eq (Array DI ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Interleaved

Methods

(==) :: Array DI ix e -> Array DI ix e -> Bool #

(/=) :: Array DI ix e -> Array DI ix e -> Bool #

(Eq e, Index ix) => Eq (Array D ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

(==) :: Array D ix e -> Array D ix e -> Bool #

(/=) :: Array D ix e -> Array D ix e -> Bool #

(Index ix, Eq e) => Eq (Array B ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

(==) :: Array B ix e -> Array B ix e -> Bool #

(/=) :: Array B ix e -> Array B ix e -> Bool #

(Index ix, Eq e) => Eq (Array BL ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

(==) :: Array BL ix e -> Array BL ix e -> Bool #

(/=) :: Array BL ix e -> Array BL ix e -> Bool #

(Index ix, NFData e, Eq e) => Eq (Array BN ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

(==) :: Array BN ix e -> Array BN ix e -> Bool #

(/=) :: Array BN ix e -> Array BN ix e -> Bool #

(Prim e, Eq e, Index ix) => Eq (Array P ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

(==) :: Array P ix e -> Array P ix e -> Bool #

(/=) :: Array P ix e -> Array P ix e -> Bool #

(Storable e, Eq e, Index ix) => Eq (Array S ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

(==) :: Array S ix e -> Array S ix e -> Bool #

(/=) :: Array S ix e -> Array S ix e -> Bool #

(Unbox e, Eq e, Index ix) => Eq (Array U ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

(==) :: Array U ix e -> Array U ix e -> Bool #

(/=) :: Array U ix e -> Array U ix e -> Bool #

(Index ix, Ord e) => Ord (Array DI ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Interleaved

Methods

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 #

max :: Array DI ix e -> Array DI ix e -> Array DI ix e #

min :: Array DI ix e -> Array DI ix e -> Array DI ix e #

(Ord e, Index ix) => Ord (Array D ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

compare :: Array D ix e -> Array D ix e -> Ordering #

(<) :: Array D ix e -> Array D ix e -> Bool #

(<=) :: Array D ix e -> Array D ix e -> Bool #

(>) :: Array D ix e -> Array D ix e -> Bool #

(>=) :: Array D ix e -> Array D ix e -> Bool #

max :: Array D ix e -> Array D ix e -> Array D ix e #

min :: Array D ix e -> Array D ix e -> Array D ix e #

(Index ix, Ord e) => Ord (Array B ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

compare :: Array B ix e -> Array B ix e -> Ordering #

(<) :: Array B ix e -> Array B ix e -> Bool #

(<=) :: Array B ix e -> Array B ix e -> Bool #

(>) :: Array B ix e -> Array B ix e -> Bool #

(>=) :: Array B ix e -> Array B ix e -> Bool #

max :: Array B ix e -> Array B ix e -> Array B ix e #

min :: Array B ix e -> Array B ix e -> Array B ix e #

(Index ix, Ord e) => Ord (Array BL ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

compare :: Array BL ix e -> Array BL ix e -> Ordering #

(<) :: Array BL ix e -> Array BL ix e -> Bool #

(<=) :: Array BL ix e -> Array BL ix e -> Bool #

(>) :: Array BL ix e -> Array BL ix e -> Bool #

(>=) :: Array BL ix e -> Array BL ix e -> Bool #

max :: Array BL ix e -> Array BL ix e -> Array BL ix e #

min :: Array BL ix e -> Array BL ix e -> Array BL ix e #

(Index ix, NFData e, Ord e) => Ord (Array BN ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

compare :: Array BN ix e -> Array BN ix e -> Ordering #

(<) :: Array BN ix e -> Array BN ix e -> Bool #

(<=) :: Array BN ix e -> Array BN ix e -> Bool #

(>) :: Array BN ix e -> Array BN ix e -> Bool #

(>=) :: Array BN ix e -> Array BN ix e -> Bool #

max :: Array BN ix e -> Array BN ix e -> Array BN ix e #

min :: Array BN ix e -> Array BN ix e -> Array BN ix e #

(Prim e, Ord e, Index ix) => Ord (Array P ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

compare :: Array P ix e -> Array P ix e -> Ordering #

(<) :: Array P ix e -> Array P ix e -> Bool #

(<=) :: Array P ix e -> Array P ix e -> Bool #

(>) :: Array P ix e -> Array P ix e -> Bool #

(>=) :: Array P ix e -> Array P ix e -> Bool #

max :: Array P ix e -> Array P ix e -> Array P ix e #

min :: Array P ix e -> Array P ix e -> Array P ix e #

(Storable e, Ord e, Index ix) => Ord (Array S ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

compare :: Array S ix e -> Array S ix e -> Ordering #

(<) :: Array S ix e -> Array S ix e -> Bool #

(<=) :: Array S ix e -> Array S ix e -> Bool #

(>) :: Array S ix e -> Array S ix e -> Bool #

(>=) :: Array S ix e -> Array S ix e -> Bool #

max :: Array S ix e -> Array S ix e -> Array S ix e #

min :: Array S ix e -> Array S ix e -> Array S ix e #

(Unbox e, Ord e, Index ix) => Ord (Array U ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

compare :: Array U ix e -> Array U ix e -> Ordering #

(<) :: Array U ix e -> Array U ix e -> Bool #

(<=) :: Array U ix e -> Array U ix e -> Bool #

(>) :: Array U ix e -> Array U ix e -> Bool #

(>=) :: Array U ix e -> Array U ix e -> Bool #

max :: Array U ix e -> Array U ix e -> Array U ix e #

min :: Array U ix e -> Array U ix e -> Array U ix e #

newtype Array DI ix e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Interleaved

newtype Array DI ix e = DIArray {}
data Array D ix e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

data Array D ix e = DArray {}
data Array DL ix e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Push

data Array DL ix e = DLArray {}
data Array DW ix e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Windowed

data Array DW ix e = DWArray {}
newtype Array B ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

newtype Array B ix e = BArray (Array BL ix e)
data Array BL ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

data Array BL ix e = BLArray {}
newtype Array BN ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

newtype Array BN ix e = BNArray (Array BL ix e)
data Array P ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

data Array P ix e = PArray {}
data Array S ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

data Array S ix e = SArray {}
data Array U ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

data Array U ix e = UArray {}
data Array L ix e Source # 
Instance details

Defined in Data.Massiv.Core.List

data Array L ix e = LArray {}
newtype Array DS Ix1 e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Stream

newtype Array DS Ix1 e = DSArray {}
type Item (Array DS Ix1 e) Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Stream

type Item (Array DS Ix1 e) = e
type Item (Array B ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

type Item (Array B ix e) = Item (Array L ix e)
type Item (Array BL ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

type Item (Array BL ix e) = Item (Array L ix e)
type Item (Array BN ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

type Item (Array BN ix e) = Item (Array L ix e)
type Item (Array P ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

type Item (Array P ix e) = Item (Array L ix e)
type Item (Array S ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

type Item (Array S ix e) = Item (Array L ix e)
type Item (Array U ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

type Item (Array U ix e) = Item (Array L ix e)
type Item (Array L ix e) Source # 
Instance details

Defined in Data.Massiv.Core.List

type Item (Array L ix e) = ListItem ix e

newtype List ix e Source #

Constructors

List 

Fields

Instances

Instances details
Coercible (Elt ix e) (ListItem ix e) => IsList (List ix e) Source # 
Instance details

Defined in Data.Massiv.Core.List

Associated Types

type Item (List ix e) #

Methods

fromList :: [Item (List ix e)] -> List ix e #

fromListN :: Int -> [Item (List ix e)] -> List ix e #

toList :: List ix e -> [Item (List ix e)] #

(Ragged L ix e, Show e) => Show (List ix e) Source # 
Instance details

Defined in Data.Massiv.Core.List

Methods

showsPrec :: Int -> List ix e -> ShowS #

show :: List ix e -> String #

showList :: [List ix e] -> ShowS #

type Item (List ix e) Source # 
Instance details

Defined in Data.Massiv.Core.List

type Item (List ix e) = ListItem ix e

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 (Strategy r, Shape r ix) => Load r ix e where Source #

Any array that can be computed and loaded into memory

Methods

iterArrayLinearST_ Source #

Arguments

:: Scheduler s () 
-> Array r ix e

Array that is being loaded

-> (Int -> e -> ST s ())

Function that writes an element into target array

-> ST s () 

Iterate over an array with a ST action that is applied to each element and its index.

Since: 1.0.0

iterArrayLinearWithSetST_ Source #

Arguments

:: Scheduler s () 
-> Array r ix e

Array that is being loaded

-> (Ix1 -> e -> ST s ())

Function that writes an element into target array

-> (Ix1 -> Sz1 -> e -> ST s ())

Function that efficiently sets a region of an array to the supplied value target array

-> ST s () 

Similar to iterArrayLinearST_. Except it also accepts a function that is potentially optimized for setting many cells in a region to the same value.

Since: 1.0.0

Instances

Instances details
Index ix => Load DI ix e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Interleaved

Methods

makeArray :: Comp -> Sz ix -> (ix -> e) -> Array DI ix e Source #

makeArrayLinear :: Comp -> Sz ix -> (Int -> e) -> Array DI ix e Source #

replicate :: Comp -> Sz ix -> e -> Array DI ix e Source #

iterArrayLinearST_ :: Scheduler s () -> Array DI ix e -> (Int -> e -> ST s ()) -> ST s () Source #

iterArrayLinearWithSetST_ :: Scheduler s () -> Array DI ix e -> (Ix1 -> e -> ST s ()) -> (Ix1 -> Sz1 -> e -> ST s ()) -> ST s () Source #

unsafeLoadIntoST :: Manifest r' e => MVector s r' e -> Array DI ix e -> ST s (MArray s r' ix e) Source #

unsafeLoadIntoIO :: Manifest r' e => MVector RealWorld r' e -> Array DI ix e -> IO (MArray RealWorld r' ix e) Source #

Index ix => Load D ix e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

makeArray :: Comp -> Sz ix -> (ix -> e) -> Array D ix e Source #

makeArrayLinear :: Comp -> Sz ix -> (Int -> e) -> Array D ix e Source #

replicate :: Comp -> Sz ix -> e -> Array D ix e Source #

iterArrayLinearST_ :: Scheduler s () -> Array D ix e -> (Int -> e -> ST s ()) -> ST s () Source #

iterArrayLinearWithSetST_ :: Scheduler s () -> Array D ix e -> (Ix1 -> e -> ST s ()) -> (Ix1 -> Sz1 -> e -> ST s ()) -> ST s () Source #

unsafeLoadIntoST :: Manifest r' e => MVector s r' e -> Array D ix e -> ST s (MArray s r' ix e) Source #

unsafeLoadIntoIO :: Manifest r' e => MVector RealWorld r' e -> Array D ix e -> IO (MArray RealWorld r' ix e) Source #

Index ix => Load DL ix e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Push

Methods

makeArray :: Comp -> Sz ix -> (ix -> e) -> Array DL ix e Source #

makeArrayLinear :: Comp -> Sz ix -> (Int -> e) -> Array DL ix e Source #

replicate :: Comp -> Sz ix -> e -> Array DL ix e Source #

iterArrayLinearST_ :: Scheduler s () -> Array DL ix e -> (Int -> e -> ST s ()) -> ST s () Source #

iterArrayLinearWithSetST_ :: Scheduler s () -> Array DL ix e -> (Ix1 -> e -> ST s ()) -> (Ix1 -> Sz1 -> e -> ST s ()) -> ST s () Source #

unsafeLoadIntoST :: Manifest r' e => MVector s r' e -> Array DL ix e -> ST s (MArray s r' ix e) Source #

unsafeLoadIntoIO :: Manifest r' e => MVector RealWorld r' e -> Array DL ix e -> IO (MArray RealWorld r' ix e) Source #

Load DS Ix1 e Source #

O(n) - size implementation.

Instance details

Defined in Data.Massiv.Array.Delayed.Stream

Methods

makeArray :: Comp -> Sz Ix1 -> (Ix1 -> e) -> Array DS Ix1 e Source #

makeArrayLinear :: Comp -> Sz Ix1 -> (Int -> e) -> Array DS Ix1 e Source #

replicate :: Comp -> Sz Ix1 -> e -> Array DS Ix1 e Source #

iterArrayLinearST_ :: Scheduler s () -> Array DS Ix1 e -> (Int -> e -> ST s ()) -> ST s () Source #

iterArrayLinearWithSetST_ :: Scheduler s () -> Array DS Ix1 e -> (Ix1 -> e -> ST s ()) -> (Ix1 -> Sz1 -> e -> ST s ()) -> ST s () Source #

unsafeLoadIntoST :: Manifest r' e => MVector s r' e -> Array DS Ix1 e -> ST s (MArray s r' Ix1 e) Source #

unsafeLoadIntoIO :: Manifest r' e => MVector RealWorld r' e -> Array DS Ix1 e -> IO (MArray RealWorld r' Ix1 e) Source #

Load DW Ix1 e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Windowed

Methods

makeArray :: Comp -> Sz Ix1 -> (Ix1 -> e) -> Array DW Ix1 e Source #

makeArrayLinear :: Comp -> Sz Ix1 -> (Int -> e) -> Array DW Ix1 e Source #

replicate :: Comp -> Sz Ix1 -> e -> Array DW Ix1 e Source #

iterArrayLinearST_ :: Scheduler s () -> Array DW Ix1 e -> (Int -> e -> ST s ()) -> ST s () Source #

iterArrayLinearWithSetST_ :: Scheduler s () -> Array DW Ix1 e -> (Ix1 -> e -> ST s ()) -> (Ix1 -> Sz1 -> e -> ST s ()) -> ST s () Source #

unsafeLoadIntoST :: Manifest r' e => MVector s r' e -> Array DW Ix1 e -> ST s (MArray s r' Ix1 e) Source #

unsafeLoadIntoIO :: Manifest r' e => MVector RealWorld r' e -> Array DW Ix1 e -> IO (MArray RealWorld r' Ix1 e) Source #

Load DW Ix2 e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Windowed

Methods

makeArray :: Comp -> Sz Ix2 -> (Ix2 -> e) -> Array DW Ix2 e Source #

makeArrayLinear :: Comp -> Sz Ix2 -> (Int -> e) -> Array DW Ix2 e Source #

replicate :: Comp -> Sz Ix2 -> e -> Array DW Ix2 e Source #

iterArrayLinearST_ :: Scheduler s () -> Array DW Ix2 e -> (Int -> e -> ST s ()) -> ST s () Source #

iterArrayLinearWithSetST_ :: Scheduler s () -> Array DW Ix2 e -> (Ix1 -> e -> ST s ()) -> (Ix1 -> Sz1 -> e -> ST s ()) -> ST s () Source #

unsafeLoadIntoST :: Manifest r' e => MVector s r' e -> Array DW Ix2 e -> ST s (MArray s r' Ix2 e) Source #

unsafeLoadIntoIO :: Manifest r' e => MVector RealWorld r' e -> Array DW Ix2 e -> IO (MArray RealWorld r' Ix2 e) Source #

Index ix => Load B ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

makeArray :: Comp -> Sz ix -> (ix -> e) -> Array B ix e Source #

makeArrayLinear :: Comp -> Sz ix -> (Int -> e) -> Array B ix e Source #

replicate :: Comp -> Sz ix -> e -> Array B ix e Source #

iterArrayLinearST_ :: Scheduler s () -> Array B ix e -> (Int -> e -> ST s ()) -> ST s () Source #

iterArrayLinearWithSetST_ :: Scheduler s () -> Array B ix e -> (Ix1 -> e -> ST s ()) -> (Ix1 -> Sz1 -> e -> ST s ()) -> ST s () Source #

unsafeLoadIntoST :: Manifest r' e => MVector s r' e -> Array B ix e -> ST s (MArray s r' ix e) Source #

unsafeLoadIntoIO :: Manifest r' e => MVector RealWorld r' e -> Array B ix e -> IO (MArray RealWorld r' ix e) Source #

Index ix => Load BL ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

makeArray :: Comp -> Sz ix -> (ix -> e) -> Array BL ix e Source #

makeArrayLinear :: Comp -> Sz ix -> (Int -> e) -> Array BL ix e Source #

replicate :: Comp -> Sz ix -> e -> Array BL ix e Source #

iterArrayLinearST_ :: Scheduler s () -> Array BL ix e -> (Int -> e -> ST s ()) -> ST s () Source #

iterArrayLinearWithSetST_ :: Scheduler s () -> Array BL ix e -> (Ix1 -> e -> ST s ()) -> (Ix1 -> Sz1 -> e -> ST s ()) -> ST s () Source #

unsafeLoadIntoST :: Manifest r' e => MVector s r' e -> Array BL ix e -> ST s (MArray s r' ix e) Source #

unsafeLoadIntoIO :: Manifest r' e => MVector RealWorld r' e -> Array BL ix e -> IO (MArray RealWorld r' ix e) Source #

(Index ix, NFData e) => Load BN ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

makeArray :: Comp -> Sz ix -> (ix -> e) -> Array BN ix e Source #

makeArrayLinear :: Comp -> Sz ix -> (Int -> e) -> Array BN ix e Source #

replicate :: Comp -> Sz ix -> e -> Array BN ix e Source #

iterArrayLinearST_ :: Scheduler s () -> Array BN ix e -> (Int -> e -> ST s ()) -> ST s () Source #

iterArrayLinearWithSetST_ :: Scheduler s () -> Array BN ix e -> (Ix1 -> e -> ST s ()) -> (Ix1 -> Sz1 -> e -> ST s ()) -> ST s () Source #

unsafeLoadIntoST :: Manifest r' e => MVector s r' e -> Array BN ix e -> ST s (MArray s r' ix e) Source #

unsafeLoadIntoIO :: Manifest r' e => MVector RealWorld r' e -> Array BN ix e -> IO (MArray RealWorld r' ix e) Source #

(Prim e, Index ix) => Load P ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

makeArray :: Comp -> Sz ix -> (ix -> e) -> Array P ix e Source #

makeArrayLinear :: Comp -> Sz ix -> (Int -> e) -> Array P ix e Source #

replicate :: Comp -> Sz ix -> e -> Array P ix e Source #

iterArrayLinearST_ :: Scheduler s () -> Array P ix e -> (Int -> e -> ST s ()) -> ST s () Source #

iterArrayLinearWithSetST_ :: Scheduler s () -> Array P ix e -> (Ix1 -> e -> ST s ()) -> (Ix1 -> Sz1 -> e -> ST s ()) -> ST s () Source #

unsafeLoadIntoST :: Manifest r' e => MVector s r' e -> Array P ix e -> ST s (MArray s r' ix e) Source #

unsafeLoadIntoIO :: Manifest r' e => MVector RealWorld r' e -> Array P ix e -> IO (MArray RealWorld r' ix e) Source #

(Index ix, Storable e) => Load S ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

makeArray :: Comp -> Sz ix -> (ix -> e) -> Array S ix e Source #

makeArrayLinear :: Comp -> Sz ix -> (Int -> e) -> Array S ix e Source #

replicate :: Comp -> Sz ix -> e -> Array S ix e Source #

iterArrayLinearST_ :: Scheduler s () -> Array S ix e -> (Int -> e -> ST s ()) -> ST s () Source #

iterArrayLinearWithSetST_ :: Scheduler s () -> Array S ix e -> (Ix1 -> e -> ST s ()) -> (Ix1 -> Sz1 -> e -> ST s ()) -> ST s () Source #

unsafeLoadIntoST :: Manifest r' e => MVector s r' e -> Array S ix e -> ST s (MArray s r' ix e) Source #

unsafeLoadIntoIO :: Manifest r' e => MVector RealWorld r' e -> Array S ix e -> IO (MArray RealWorld r' ix e) Source #

(Unbox e, Index ix) => Load U ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

makeArray :: Comp -> Sz ix -> (ix -> e) -> Array U ix e Source #

makeArrayLinear :: Comp -> Sz ix -> (Int -> e) -> Array U ix e Source #

replicate :: Comp -> Sz ix -> e -> Array U ix e Source #

iterArrayLinearST_ :: Scheduler s () -> Array U ix e -> (Int -> e -> ST s ()) -> ST s () Source #

iterArrayLinearWithSetST_ :: Scheduler s () -> Array U ix e -> (Ix1 -> e -> ST s ()) -> (Ix1 -> Sz1 -> e -> ST s ()) -> ST s () Source #

unsafeLoadIntoST :: Manifest r' e => MVector s r' e -> Array U ix e -> ST s (MArray s r' ix e) Source #

unsafeLoadIntoIO :: Manifest r' e => MVector RealWorld r' e -> Array U ix e -> IO (MArray RealWorld r' ix e) Source #

(Shape L ix, Ragged L ix e) => Load L ix e Source # 
Instance details

Defined in Data.Massiv.Core.List

Methods

makeArray :: Comp -> Sz ix -> (ix -> e) -> Array L ix e Source #

makeArrayLinear :: Comp -> Sz ix -> (Int -> e) -> Array L ix e Source #

replicate :: Comp -> Sz ix -> e -> Array L ix e Source #

iterArrayLinearST_ :: Scheduler s () -> Array L ix e -> (Int -> e -> ST s ()) -> ST s () Source #

iterArrayLinearWithSetST_ :: Scheduler s () -> Array L ix e -> (Ix1 -> e -> ST s ()) -> (Ix1 -> Sz1 -> e -> ST s ()) -> ST s () Source #

unsafeLoadIntoST :: Manifest r' e => MVector s r' e -> Array L ix e -> ST s (MArray s r' ix e) Source #

unsafeLoadIntoIO :: Manifest r' e => MVector RealWorld r' e -> Array L ix e -> IO (MArray RealWorld r' ix e) Source #

(Index (IxN n), Load DW (Ix (n - 1)) e) => Load DW (IxN n) e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Windowed

Methods

makeArray :: Comp -> Sz (IxN n) -> (IxN n -> e) -> Array DW (IxN n) e Source #

makeArrayLinear :: Comp -> Sz (IxN n) -> (Int -> e) -> Array DW (IxN n) e Source #

replicate :: Comp -> Sz (IxN n) -> e -> Array DW (IxN n) e Source #

iterArrayLinearST_ :: Scheduler s () -> Array DW (IxN n) e -> (Int -> e -> ST s ()) -> ST s () Source #

iterArrayLinearWithSetST_ :: Scheduler s () -> Array DW (IxN n) e -> (Ix1 -> e -> ST s ()) -> (Ix1 -> Sz1 -> e -> ST s ()) -> ST s () Source #

unsafeLoadIntoST :: Manifest r' e => MVector s r' e -> Array DW (IxN n) e -> ST s (MArray s r' (IxN n) e) Source #

unsafeLoadIntoIO :: Manifest r' e => MVector RealWorld r' e -> Array DW (IxN n) e -> IO (MArray RealWorld r' (IxN n) e) Source #

class Load r ix e => Stream r ix e where Source #

Methods

toStream :: Array r ix e -> Steps Id e Source #

toStreamIx :: Array r ix e -> Steps Id (ix, e) Source #

Instances

Instances details
Index ix => Stream D ix e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

toStream :: Array D ix e -> Steps Id e Source #

toStreamIx :: Array D ix e -> Steps Id (ix, e) Source #

Stream DS Ix1 e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Stream

Methods

toStream :: Array DS Ix1 e -> Steps Id e Source #

toStreamIx :: Array DS Ix1 e -> Steps Id (Ix1, e) Source #

Index ix => Stream B ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

toStream :: Array B ix e -> Steps Id e Source #

toStreamIx :: Array B ix e -> Steps Id (ix, e) Source #

Index ix => Stream BL ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

toStream :: Array BL ix e -> Steps Id e Source #

toStreamIx :: Array BL ix e -> Steps Id (ix, e) Source #

(Index ix, NFData e) => Stream BN ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

toStream :: Array BN ix e -> Steps Id e Source #

toStreamIx :: Array BN ix e -> Steps Id (ix, e) Source #

(Prim e, Index ix) => Stream P ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

toStream :: Array P ix e -> Steps Id e Source #

toStreamIx :: Array P ix e -> Steps Id (ix, e) Source #

(Index ix, Storable e) => Stream S ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

toStream :: Array S ix e -> Steps Id e Source #

toStreamIx :: Array S ix e -> Steps Id (ix, e) Source #

(Index ix, Unbox e) => Stream U ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

toStream :: Array U ix e -> Steps Id e Source #

toStreamIx :: Array U ix e -> Steps Id (ix, e) Source #

Stream L Ix1 e Source # 
Instance details

Defined in Data.Massiv.Core.List

Methods

toStream :: Array L Ix1 e -> Steps Id e Source #

toStreamIx :: Array L Ix1 e -> Steps Id (Ix1, e) Source #

class (Strategy r, Size r) => Source r e Source #

Arrays that can be used as source to practically any manipulation function.

Minimal complete definition

(unsafeIndex | unsafeLinearIndex), unsafeLinearSlice

Instances

Instances details
Source D e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

unsafeIndex :: Index ix => Array D ix e -> ix -> e Source #

unsafeLinearIndex :: Index ix => Array D ix e -> Int -> e Source #

unsafePrefIndex :: Index ix => Array D ix e -> PrefIndex ix e Source #

unsafeOuterSlice :: (Index ix, Index (Lower ix)) => Array D ix e -> Sz (Lower ix) -> Int -> Array D (Lower ix) e Source #

unsafeLinearSlice :: Index ix => Ix1 -> Sz1 -> Array D ix e -> Array D Ix1 e Source #

Source B e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeIndex :: Index ix => Array B ix e -> ix -> e Source #

unsafeLinearIndex :: Index ix => Array B ix e -> Int -> e Source #

unsafePrefIndex :: Index ix => Array B ix e -> PrefIndex ix e Source #

unsafeOuterSlice :: (Index ix, Index (Lower ix)) => Array B ix e -> Sz (Lower ix) -> Int -> Array B (Lower ix) e Source #

unsafeLinearSlice :: Index ix => Ix1 -> Sz1 -> Array B ix e -> Array B Ix1 e Source #

Source BL e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeIndex :: Index ix => Array BL ix e -> ix -> e Source #

unsafeLinearIndex :: Index ix => Array BL ix e -> Int -> e Source #

unsafePrefIndex :: Index ix => Array BL ix e -> PrefIndex ix e Source #

unsafeOuterSlice :: (Index ix, Index (Lower ix)) => Array BL ix e -> Sz (Lower ix) -> Int -> Array BL (Lower ix) e Source #

unsafeLinearSlice :: Index ix => Ix1 -> Sz1 -> Array BL ix e -> Array BL Ix1 e Source #

NFData e => Source BN e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeIndex :: Index ix => Array BN ix e -> ix -> e Source #

unsafeLinearIndex :: Index ix => Array BN ix e -> Int -> e Source #

unsafePrefIndex :: Index ix => Array BN ix e -> PrefIndex ix e Source #

unsafeOuterSlice :: (Index ix, Index (Lower ix)) => Array BN ix e -> Sz (Lower ix) -> Int -> Array BN (Lower ix) e Source #

unsafeLinearSlice :: Index ix => Ix1 -> Sz1 -> Array BN ix e -> Array BN Ix1 e Source #

Prim e => Source P e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

unsafeIndex :: Index ix => Array P ix e -> ix -> e Source #

unsafeLinearIndex :: Index ix => Array P ix e -> Int -> e Source #

unsafePrefIndex :: Index ix => Array P ix e -> PrefIndex ix e Source #

unsafeOuterSlice :: (Index ix, Index (Lower ix)) => Array P ix e -> Sz (Lower ix) -> Int -> Array P (Lower ix) e Source #

unsafeLinearSlice :: Index ix => Ix1 -> Sz1 -> Array P ix e -> Array P Ix1 e Source #

Storable e => Source S e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

unsafeIndex :: Index ix => Array S ix e -> ix -> e Source #

unsafeLinearIndex :: Index ix => Array S ix e -> Int -> e Source #

unsafePrefIndex :: Index ix => Array S ix e -> PrefIndex ix e Source #

unsafeOuterSlice :: (Index ix, Index (Lower ix)) => Array S ix e -> Sz (Lower ix) -> Int -> Array S (Lower ix) e Source #

unsafeLinearSlice :: Index ix => Ix1 -> Sz1 -> Array S ix e -> Array S Ix1 e Source #

Unbox e => Source U e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

unsafeIndex :: Index ix => Array U ix e -> ix -> e Source #

unsafeLinearIndex :: Index ix => Array U ix e -> Int -> e Source #

unsafePrefIndex :: Index ix => Array U ix e -> PrefIndex ix e Source #

unsafeOuterSlice :: (Index ix, Index (Lower ix)) => Array U ix e -> Sz (Lower ix) -> Int -> Array U (Lower ix) e Source #

unsafeLinearSlice :: Index ix => Ix1 -> Sz1 -> Array U ix e -> Array U Ix1 e Source #

data PrefIndex ix e Source #

Prefered indexing function.

Constructors

PrefIndex (ix -> e) 
PrefIndexLinear (Int -> e) 

Instances

Instances details
Functor (PrefIndex ix) Source # 
Instance details

Defined in Data.Massiv.Core.Common

Methods

fmap :: (a -> b) -> PrefIndex ix a -> PrefIndex ix b #

(<$) :: a -> PrefIndex ix b -> PrefIndex ix a #

class Size r Source #

Arrays that have information about their size availible in constant time.

Minimal complete definition

size, unsafeResize

Instances

Instances details
Size DI Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Interleaved

Methods

size :: Array DI ix e -> Sz ix Source #

unsafeResize :: (Index ix, Index ix') => Sz ix' -> Array DI ix e -> Array DI ix' e Source #

Size D Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

size :: Array D ix e -> Sz ix Source #

unsafeResize :: (Index ix, Index ix') => Sz ix' -> Array D ix e -> Array D ix' e Source #

Size DL Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Push

Methods

size :: Array DL ix e -> Sz ix Source #

unsafeResize :: (Index ix, Index ix') => Sz ix' -> Array DL ix e -> Array DL ix' e Source #

Size B Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

size :: Array B ix e -> Sz ix Source #

unsafeResize :: (Index ix, Index ix') => Sz ix' -> Array B ix e -> Array B ix' e Source #

Size BL Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

size :: Array BL ix e -> Sz ix Source #

unsafeResize :: (Index ix, Index ix') => Sz ix' -> Array BL ix e -> Array BL ix' e Source #

Size BN Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

size :: Array BN ix e -> Sz ix Source #

unsafeResize :: (Index ix, Index ix') => Sz ix' -> Array BN ix e -> Array BN ix' e Source #

Size P Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

size :: Array P ix e -> Sz ix Source #

unsafeResize :: (Index ix, Index ix') => Sz ix' -> Array P ix e -> Array P ix' e Source #

Size S Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

size :: Array S ix e -> Sz ix Source #

unsafeResize :: (Index ix, Index ix') => Sz ix' -> Array S ix e -> Array S ix' e Source #

Size U Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

size :: Array U ix e -> Sz ix Source #

unsafeResize :: (Index ix, Index ix') => Sz ix' -> Array U ix e -> Array U ix' e Source #

class Index ix => Shape r ix where Source #

The shape of an array. It is different from Size in that it can be applicable to non-square matrices and might not be available in constant time.

Since: 1.0.0

Minimal complete definition

Nothing

Methods

linearSizeHint :: Array r ix e -> LengthHint Source #

O(1) - Check what do we know about the number of elements without doing any work

Since: 1.0.0

linearSize :: Array r ix e -> Sz1 Source #

O(n) - possibly iterate over the whole array before producing the answer

Since: 0.5.8

default linearSize :: Size r => Array r ix e -> Sz1 Source #

outerSize :: Array r ix e -> Sz ix Source #

O(n) - Rectangular size of an array that is inferred from looking at the first row in each dimensions. For rectangular arrays this is the same as size

Since: 1.0.0

default outerSize :: Size r => Array r ix e -> Sz ix Source #

maxLinearSize :: Array r ix e -> Maybe Sz1 Source #

O(1) - Get the possible maximum linear size of an immutabe array. If the lookup of size in constant time is not possible, Nothing will be returned. This value will be used as the initial size of the mutable array into which the loading will happen.

Since: 1.0.0

isNull :: Array r ix e -> Bool Source #

O(1) - Check whether an array is empty or not.

Examples

Expand
>>> import Data.Massiv.Array
>>> isNull $ range Seq (Ix2 10 20) (11 :. 21)
False
>>> isNull $ range Seq (Ix2 10 20) (10 :. 21)
True
>>> isNull (empty :: Array D Ix5 Int)
True
>>> isNull $ sfromList []
True

Since: 1.0.0

Instances

Instances details
Index ix => Shape DI ix Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Interleaved

Index ix => Shape D ix Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Index ix => Shape DL ix Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Push

Shape DS Ix1 Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Stream

Index ix => Shape DW ix Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Windowed

Index ix => Shape B ix Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Index ix => Shape BL ix Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Index ix => Shape BN ix Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Index ix => Shape P ix Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Index ix => Shape S ix Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Index ix => Shape U ix Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Shape L Ix1 Source # 
Instance details

Defined in Data.Massiv.Core.List

Shape L Ix2 Source # 
Instance details

Defined in Data.Massiv.Core.List

(Shape L (Ix (n - 1)), Index (IxN n)) => Shape L (IxN n) Source # 
Instance details

Defined in Data.Massiv.Core.List

data LengthHint Source #

Size hint

Since: 1.0.0

Constructors

LengthExact Sz1

Exact known size

LengthMax Sz1

Upper bound on the size

LengthUnknown

Unknown size

Instances

Instances details
Show LengthHint Source # 
Instance details

Defined in Data.Massiv.Core.Common

Eq LengthHint Source # 
Instance details

Defined in Data.Massiv.Core.Common

class Load r ix e => StrideLoad r ix e where Source #

Minimal complete definition

Nothing

Methods

iterArrayLinearWithStrideST_ Source #

Arguments

:: Scheduler s () 
-> 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 -> ST s ())

Function that writes an element into target array

-> ST s () 

Load an array into memory with stride. Default implementation requires an instance of Source.

default iterArrayLinearWithStrideST_ :: Source r e => Scheduler s () -> Stride ix -> Sz ix -> Array r ix e -> (Int -> e -> ST s ()) -> ST s () Source #

Instances

Instances details
Index ix => StrideLoad DI ix e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Interleaved

Methods

iterArrayLinearWithStrideST_ :: Scheduler s () -> Stride ix -> Sz ix -> Array DI ix e -> (Int -> e -> ST s ()) -> ST s () Source #

Index ix => StrideLoad D ix e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

iterArrayLinearWithStrideST_ :: Scheduler s () -> Stride ix -> Sz ix -> Array D ix e -> (Int -> e -> ST s ()) -> ST s () Source #

StrideLoad DW Ix1 e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Windowed

Methods

iterArrayLinearWithStrideST_ :: Scheduler s () -> Stride Ix1 -> Sz Ix1 -> Array DW Ix1 e -> (Int -> e -> ST s ()) -> ST s () Source #

StrideLoad DW Ix2 e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Windowed

Methods

iterArrayLinearWithStrideST_ :: Scheduler s () -> Stride Ix2 -> Sz Ix2 -> Array DW Ix2 e -> (Int -> e -> ST s ()) -> ST s () Source #

Index ix => StrideLoad B ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

iterArrayLinearWithStrideST_ :: Scheduler s () -> Stride ix -> Sz ix -> Array B ix e -> (Int -> e -> ST s ()) -> ST s () Source #

Index ix => StrideLoad BL ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

iterArrayLinearWithStrideST_ :: Scheduler s () -> Stride ix -> Sz ix -> Array BL ix e -> (Int -> e -> ST s ()) -> ST s () Source #

(Index ix, NFData e) => StrideLoad BN ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

iterArrayLinearWithStrideST_ :: Scheduler s () -> Stride ix -> Sz ix -> Array BN ix e -> (Int -> e -> ST s ()) -> ST s () Source #

(Prim e, Index ix) => StrideLoad P ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

iterArrayLinearWithStrideST_ :: Scheduler s () -> Stride ix -> Sz ix -> Array P ix e -> (Int -> e -> ST s ()) -> ST s () Source #

(Index ix, Storable e) => StrideLoad S ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

iterArrayLinearWithStrideST_ :: Scheduler s () -> Stride ix -> Sz ix -> Array S ix e -> (Int -> e -> ST s ()) -> ST s () Source #

(Unbox e, Index ix) => StrideLoad U ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

iterArrayLinearWithStrideST_ :: Scheduler s () -> Stride ix -> Sz ix -> Array U ix e -> (Int -> e -> ST s ()) -> ST s () Source #

(Index (IxN n), StrideLoad DW (Ix (n - 1)) e) => StrideLoad DW (IxN n) e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Windowed

Methods

iterArrayLinearWithStrideST_ :: Scheduler s () -> Stride (IxN n) -> Sz (IxN n) -> Array DW (IxN n) e -> (Int -> e -> ST s ()) -> ST s () Source #

class Source r e => Manifest r e Source #

Manifest arrays are backed by actual memory and values are looked up versus computed as it is with delayed arrays. Because manifest arrays are located in memory their contents can be mutated once thawed into MArray. The process of changed a mutable MArray back into an immutable Array is called freezing.

Instances

Instances details
Manifest B e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeLinearIndexM :: Index ix => Array B ix e -> Int -> e Source #

sizeOfMArray :: Index ix => MArray s B ix e -> Sz ix Source #

unsafeResizeMArray :: (Index ix', Index ix) => Sz ix' -> MArray s B ix e -> MArray s B ix' e Source #

unsafeLinearSliceMArray :: Index ix => Ix1 -> Sz1 -> MArray s B ix e -> MVector s B e Source #

unsafeThaw :: (Index ix, PrimMonad m) => Array B ix e -> m (MArray (PrimState m) B ix e) Source #

unsafeFreeze :: (Index ix, PrimMonad m) => Comp -> MArray (PrimState m) B ix e -> m (Array B ix e) Source #

unsafeNew :: (Index ix, PrimMonad m) => Sz ix -> m (MArray (PrimState m) B ix e) Source #

unsafeLinearRead :: (Index ix, PrimMonad m) => MArray (PrimState m) B ix e -> Int -> m e Source #

unsafeLinearWrite :: (Index ix, PrimMonad m) => MArray (PrimState m) B ix e -> Int -> e -> m () Source #

initialize :: (Index ix, PrimMonad m) => MArray (PrimState m) B ix e -> m () Source #

initializeNew :: (Index ix, PrimMonad m) => Maybe e -> Sz ix -> m (MArray (PrimState m) B ix e) Source #

newMArray :: (Index ix, PrimMonad m) => Sz ix -> e -> m (MArray (PrimState m) B ix e) Source #

unsafeLinearSet :: (Index ix, PrimMonad m) => MArray (PrimState m) B ix e -> Ix1 -> Sz1 -> e -> m () Source #

unsafeLinearCopy :: (Index ix', Index ix, PrimMonad m) => MArray (PrimState m) B ix' e -> Ix1 -> MArray (PrimState m) B ix e -> Ix1 -> Sz1 -> m () Source #

unsafeArrayLinearCopy :: (Index ix', Index ix, PrimMonad m) => Array B ix' e -> Ix1 -> MArray (PrimState m) B ix e -> Ix1 -> Sz1 -> m () Source #

unsafeLinearShrink :: (Index ix, PrimMonad m) => MArray (PrimState m) B ix e -> Sz ix -> m (MArray (PrimState m) B ix e) Source #

unsafeLinearGrow :: (Index ix, PrimMonad m) => MArray (PrimState m) B ix e -> Sz ix -> m (MArray (PrimState m) B ix e) Source #

Manifest BL e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeLinearIndexM :: Index ix => Array BL ix e -> Int -> e Source #

sizeOfMArray :: Index ix => MArray s BL ix e -> Sz ix Source #

unsafeResizeMArray :: (Index ix', Index ix) => Sz ix' -> MArray s BL ix e -> MArray s BL ix' e Source #

unsafeLinearSliceMArray :: Index ix => Ix1 -> Sz1 -> MArray s BL ix e -> MVector s BL e Source #

unsafeThaw :: (Index ix, PrimMonad m) => Array BL ix e -> m (MArray (PrimState m) BL ix e) Source #

unsafeFreeze :: (Index ix, PrimMonad m) => Comp -> MArray (PrimState m) BL ix e -> m (Array BL ix e) Source #

unsafeNew :: (Index ix, PrimMonad m) => Sz ix -> m (MArray (PrimState m) BL ix e) Source #

unsafeLinearRead :: (Index ix, PrimMonad m) => MArray (PrimState m) BL ix e -> Int -> m e Source #

unsafeLinearWrite :: (Index ix, PrimMonad m) => MArray (PrimState m) BL ix e -> Int -> e -> m () Source #

initialize :: (Index ix, PrimMonad m) => MArray (PrimState m) BL ix e -> m () Source #

initializeNew :: (Index ix, PrimMonad m) => Maybe e -> Sz ix -> m (MArray (PrimState m) BL ix e) Source #

newMArray :: (Index ix, PrimMonad m) => Sz ix -> e -> m (MArray (PrimState m) BL ix e) Source #

unsafeLinearSet :: (Index ix, PrimMonad m) => MArray (PrimState m) BL ix e -> Ix1 -> Sz1 -> e -> m () Source #

unsafeLinearCopy :: (Index ix', Index ix, PrimMonad m) => MArray (PrimState m) BL ix' e -> Ix1 -> MArray (PrimState m) BL ix e -> Ix1 -> Sz1 -> m () Source #

unsafeArrayLinearCopy :: (Index ix', Index ix, PrimMonad m) => Array BL ix' e -> Ix1 -> MArray (PrimState m) BL ix e -> Ix1 -> Sz1 -> m () Source #

unsafeLinearShrink :: (Index ix, PrimMonad m) => MArray (PrimState m) BL ix e -> Sz ix -> m (MArray (PrimState m) BL ix e) Source #

unsafeLinearGrow :: (Index ix, PrimMonad m) => MArray (PrimState m) BL ix e -> Sz ix -> m (MArray (PrimState m) BL ix e) Source #

NFData e => Manifest BN e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeLinearIndexM :: Index ix => Array BN ix e -> Int -> e Source #

sizeOfMArray :: Index ix => MArray s BN ix e -> Sz ix Source #

unsafeResizeMArray :: (Index ix', Index ix) => Sz ix' -> MArray s BN ix e -> MArray s BN ix' e Source #

unsafeLinearSliceMArray :: Index ix => Ix1 -> Sz1 -> MArray s BN ix e -> MVector s BN e Source #

unsafeThaw :: (Index ix, PrimMonad m) => Array BN ix e -> m (MArray (PrimState m) BN ix e) Source #

unsafeFreeze :: (Index ix, PrimMonad m) => Comp -> MArray (PrimState m) BN ix e -> m (Array BN ix e) Source #

unsafeNew :: (Index ix, PrimMonad m) => Sz ix -> m (MArray (PrimState m) BN ix e) Source #

unsafeLinearRead :: (Index ix, PrimMonad m) => MArray (PrimState m) BN ix e -> Int -> m e Source #

unsafeLinearWrite :: (Index ix, PrimMonad m) => MArray (PrimState m) BN ix e -> Int -> e -> m () Source #

initialize :: (Index ix, PrimMonad m) => MArray (PrimState m) BN ix e -> m () Source #

initializeNew :: (Index ix, PrimMonad m) => Maybe e -> Sz ix -> m (MArray (PrimState m) BN ix e) Source #

newMArray :: (Index ix, PrimMonad m) => Sz ix -> e -> m (MArray (PrimState m) BN ix e) Source #

unsafeLinearSet :: (Index ix, PrimMonad m) => MArray (PrimState m) BN ix e -> Ix1 -> Sz1 -> e -> m () Source #

unsafeLinearCopy :: (Index ix', Index ix, PrimMonad m) => MArray (PrimState m) BN ix' e -> Ix1 -> MArray (PrimState m) BN ix e -> Ix1 -> Sz1 -> m () Source #

unsafeArrayLinearCopy :: (Index ix', Index ix, PrimMonad m) => Array BN ix' e -> Ix1 -> MArray (PrimState m) BN ix e -> Ix1 -> Sz1 -> m () Source #

unsafeLinearShrink :: (Index ix, PrimMonad m) => MArray (PrimState m) BN ix e -> Sz ix -> m (MArray (PrimState m) BN ix e) Source #

unsafeLinearGrow :: (Index ix, PrimMonad m) => MArray (PrimState m) BN ix e -> Sz ix -> m (MArray (PrimState m) BN ix e) Source #

Prim e => Manifest P e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

unsafeLinearIndexM :: Index ix => Array P ix e -> Int -> e Source #

sizeOfMArray :: Index ix => MArray s P ix e -> Sz ix Source #

unsafeResizeMArray :: (Index ix', Index ix) => Sz ix' -> MArray s P ix e -> MArray s P ix' e Source #

unsafeLinearSliceMArray :: Index ix => Ix1 -> Sz1 -> MArray s P ix e -> MVector s P e Source #

unsafeThaw :: (Index ix, PrimMonad m) => Array P ix e -> m (MArray (PrimState m) P ix e) Source #

unsafeFreeze :: (Index ix, PrimMonad m) => Comp -> MArray (PrimState m) P ix e -> m (Array P ix e) Source #

unsafeNew :: (Index ix, PrimMonad m) => Sz ix -> m (MArray (PrimState m) P ix e) Source #

unsafeLinearRead :: (Index ix, PrimMonad m) => MArray (PrimState m) P ix e -> Int -> m e Source #

unsafeLinearWrite :: (Index ix, PrimMonad m) => MArray (PrimState m) P ix e -> Int -> e -> m () Source #

initialize :: (Index ix, PrimMonad m) => MArray (PrimState m) P ix e -> m () Source #

initializeNew :: (Index ix, PrimMonad m) => Maybe e -> Sz ix -> m (MArray (PrimState m) P ix e) Source #

newMArray :: (Index ix, PrimMonad m) => Sz ix -> e -> m (MArray (PrimState m) P ix e) Source #

unsafeLinearSet :: (Index ix, PrimMonad m) => MArray (PrimState m) P ix e -> Ix1 -> Sz1 -> e -> m () Source #

unsafeLinearCopy :: (Index ix', Index ix, PrimMonad m) => MArray (PrimState m) P ix' e -> Ix1 -> MArray (PrimState m) P ix e -> Ix1 -> Sz1 -> m () Source #

unsafeArrayLinearCopy :: (Index ix', Index ix, PrimMonad m) => Array P ix' e -> Ix1 -> MArray (PrimState m) P ix e -> Ix1 -> Sz1 -> m () Source #

unsafeLinearShrink :: (Index ix, PrimMonad m) => MArray (PrimState m) P ix e -> Sz ix -> m (MArray (PrimState m) P ix e) Source #

unsafeLinearGrow :: (Index ix, PrimMonad m) => MArray (PrimState m) P ix e -> Sz ix -> m (MArray (PrimState m) P ix e) Source #

Storable e => Manifest S e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

unsafeLinearIndexM :: Index ix => Array S ix e -> Int -> e Source #

sizeOfMArray :: Index ix => MArray s S ix e -> Sz ix Source #

unsafeResizeMArray :: (Index ix', Index ix) => Sz ix' -> MArray s S ix e -> MArray s S ix' e Source #

unsafeLinearSliceMArray :: Index ix => Ix1 -> Sz1 -> MArray s S ix e -> MVector s S e Source #

unsafeThaw :: (Index ix, PrimMonad m) => Array S ix e -> m (MArray (PrimState m) S ix e) Source #

unsafeFreeze :: (Index ix, PrimMonad m) => Comp -> MArray (PrimState m) S ix e -> m (Array S ix e) Source #

unsafeNew :: (Index ix, PrimMonad m) => Sz ix -> m (MArray (PrimState m) S ix e) Source #

unsafeLinearRead :: (Index ix, PrimMonad m) => MArray (PrimState m) S ix e -> Int -> m e Source #

unsafeLinearWrite :: (Index ix, PrimMonad m) => MArray (PrimState m) S ix e -> Int -> e -> m () Source #

initialize :: (Index ix, PrimMonad m) => MArray (PrimState m) S ix e -> m () Source #

initializeNew :: (Index ix, PrimMonad m) => Maybe e -> Sz ix -> m (MArray (PrimState m) S ix e) Source #

newMArray :: (Index ix, PrimMonad m) => Sz ix -> e -> m (MArray (PrimState m) S ix e) Source #

unsafeLinearSet :: (Index ix, PrimMonad m) => MArray (PrimState m) S ix e -> Ix1 -> Sz1 -> e -> m () Source #

unsafeLinearCopy :: (Index ix', Index ix, PrimMonad m) => MArray (PrimState m) S ix' e -> Ix1 -> MArray (PrimState m) S ix e -> Ix1 -> Sz1 -> m () Source #

unsafeArrayLinearCopy :: (Index ix', Index ix, PrimMonad m) => Array S ix' e -> Ix1 -> MArray (PrimState m) S ix e -> Ix1 -> Sz1 -> m () Source #

unsafeLinearShrink :: (Index ix, PrimMonad m) => MArray (PrimState m) S ix e -> Sz ix -> m (MArray (PrimState m) S ix e) Source #

unsafeLinearGrow :: (Index ix, PrimMonad m) => MArray (PrimState m) S ix e -> Sz ix -> m (MArray (PrimState m) S ix e) Source #

Unbox e => Manifest U e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

unsafeLinearIndexM :: Index ix => Array U ix e -> Int -> e Source #

sizeOfMArray :: Index ix => MArray s U ix e -> Sz ix Source #

unsafeResizeMArray :: (Index ix', Index ix) => Sz ix' -> MArray s U ix e -> MArray s U ix' e Source #

unsafeLinearSliceMArray :: Index ix => Ix1 -> Sz1 -> MArray s U ix e -> MVector s U e Source #

unsafeThaw :: (Index ix, PrimMonad m) => Array U ix e -> m (MArray (PrimState m) U ix e) Source #

unsafeFreeze :: (Index ix, PrimMonad m) => Comp -> MArray (PrimState m) U ix e -> m (Array U ix e) Source #

unsafeNew :: (Index ix, PrimMonad m) => Sz ix -> m (MArray (PrimState m) U ix e) Source #

unsafeLinearRead :: (Index ix, PrimMonad m) => MArray (PrimState m) U ix e -> Int -> m e Source #

unsafeLinearWrite :: (Index ix, PrimMonad m) => MArray (PrimState m) U ix e -> Int -> e -> m () Source #

initialize :: (Index ix, PrimMonad m) => MArray (PrimState m) U ix e -> m () Source #

initializeNew :: (Index ix, PrimMonad m) => Maybe e -> Sz ix -> m (MArray (PrimState m) U ix e) Source #

newMArray :: (Index ix, PrimMonad m) => Sz ix -> e -> m (MArray (PrimState m) U ix e) Source #

unsafeLinearSet :: (Index ix, PrimMonad m) => MArray (PrimState m) U ix e -> Ix1 -> Sz1 -> e -> m () Source #

unsafeLinearCopy :: (Index ix', Index ix, PrimMonad m) => MArray (PrimState m) U ix' e -> Ix1 -> MArray (PrimState m) U ix e -> Ix1 -> Sz1 -> m () Source #

unsafeArrayLinearCopy :: (Index ix', Index ix, PrimMonad m) => Array U ix' e -> Ix1 -> MArray (PrimState m) U ix e -> Ix1 -> Sz1 -> m () Source #

unsafeLinearShrink :: (Index ix, PrimMonad m) => MArray (PrimState m) U ix e -> Sz ix -> m (MArray (PrimState m) U ix e) Source #

unsafeLinearGrow :: (Index ix, PrimMonad m) => MArray (PrimState m) U ix e -> Sz ix -> m (MArray (PrimState m) U ix e) Source #

type Mutable r e = Manifest r e Source #

Deprecated: In favor of Manifest

Starting with massiv-1.0 Mutable and Manifest are synonymous. Since massiv-1.1 it is deprecated and will be removed in massiv-1.2

class (IsList (Array r ix e), Load r ix e) => Ragged r ix e Source #

Minimal complete definition

generateRaggedM, flattenRagged, loadRaggedST, raggedFormat

Instances

Instances details
Ragged L Ix1 e Source # 
Instance details

Defined in Data.Massiv.Core.List

Methods

generateRaggedM :: Monad m => Comp -> Sz Ix1 -> (Ix1 -> m e) -> m (Array L Ix1 e)

flattenRagged :: Array L Ix1 e -> Vector L e

loadRaggedST :: Scheduler s () -> Array L Ix1 e -> (Ix1 -> e -> ST s ()) -> Ix1 -> Ix1 -> Sz Ix1 -> ST s ()

raggedFormat :: (e -> String) -> String -> Array L Ix1 e -> String

Ragged L Ix2 e Source # 
Instance details

Defined in Data.Massiv.Core.List

Methods

generateRaggedM :: Monad m => Comp -> Sz Ix2 -> (Ix2 -> m e) -> m (Array L Ix2 e)

flattenRagged :: Array L Ix2 e -> Vector L e

loadRaggedST :: Scheduler s () -> Array L Ix2 e -> (Ix1 -> e -> ST s ()) -> Ix1 -> Ix1 -> Sz Ix2 -> ST s ()

raggedFormat :: (e -> String) -> String -> Array L Ix2 e -> String

(Shape L (IxN n), Ragged L (Ix (n - 1)) e, Coercible (Elt (Ix (n - 1)) e) (ListItem (Ix (n - 1)) e)) => Ragged L (IxN n) e Source # 
Instance details

Defined in Data.Massiv.Core.List

Methods

generateRaggedM :: Monad m => Comp -> Sz (IxN n) -> (IxN n -> m e) -> m (Array L (IxN n) e)

flattenRagged :: Array L (IxN n) e -> Vector L e

loadRaggedST :: Scheduler s () -> Array L (IxN n) e -> (Ix1 -> e -> ST s ()) -> Ix1 -> Ix1 -> Sz (IxN n) -> ST s ()

raggedFormat :: (e -> String) -> String -> Array L (IxN n) e -> String

data L Source #

Constructors

L 

Instances

Instances details
Strategy L Source # 
Instance details

Defined in Data.Massiv.Core.List

Methods

setComp :: Comp -> Array L ix e -> Array L ix e Source #

getComp :: Array L ix e -> Comp Source #

repr :: L

Shape L Ix1 Source # 
Instance details

Defined in Data.Massiv.Core.List

Shape L Ix2 Source # 
Instance details

Defined in Data.Massiv.Core.List

(Shape L ix, Ragged L ix e) => Load L ix e Source # 
Instance details

Defined in Data.Massiv.Core.List

Methods

makeArray :: Comp -> Sz ix -> (ix -> e) -> Array L ix e Source #

makeArrayLinear :: Comp -> Sz ix -> (Int -> e) -> Array L ix e Source #

replicate :: Comp -> Sz ix -> e -> Array L ix e Source #

iterArrayLinearST_ :: Scheduler s () -> Array L ix e -> (Int -> e -> ST s ()) -> ST s () Source #

iterArrayLinearWithSetST_ :: Scheduler s () -> Array L ix e -> (Ix1 -> e -> ST s ()) -> (Ix1 -> Sz1 -> e -> ST s ()) -> ST s () Source #

unsafeLoadIntoST :: Manifest r' e => MVector s r' e -> Array L ix e -> ST s (MArray s r' ix e) Source #

unsafeLoadIntoIO :: Manifest r' e => MVector RealWorld r' e -> Array L ix e -> IO (MArray RealWorld r' ix e) Source #

Ragged L Ix1 e Source # 
Instance details

Defined in Data.Massiv.Core.List

Methods

generateRaggedM :: Monad m => Comp -> Sz Ix1 -> (Ix1 -> m e) -> m (Array L Ix1 e)

flattenRagged :: Array L Ix1 e -> Vector L e

loadRaggedST :: Scheduler s () -> Array L Ix1 e -> (Ix1 -> e -> ST s ()) -> Ix1 -> Ix1 -> Sz Ix1 -> ST s ()

raggedFormat :: (e -> String) -> String -> Array L Ix1 e -> String

Ragged L Ix2 e Source # 
Instance details

Defined in Data.Massiv.Core.List

Methods

generateRaggedM :: Monad m => Comp -> Sz Ix2 -> (Ix2 -> m e) -> m (Array L Ix2 e)

flattenRagged :: Array L Ix2 e -> Vector L e

loadRaggedST :: Scheduler s () -> Array L Ix2 e -> (Ix1 -> e -> ST s ()) -> Ix1 -> Ix1 -> Sz Ix2 -> ST s ()

raggedFormat :: (e -> String) -> String -> Array L Ix2 e -> String

Stream L Ix1 e Source # 
Instance details

Defined in Data.Massiv.Core.List

Methods

toStream :: Array L Ix1 e -> Steps Id e Source #

toStreamIx :: Array L Ix1 e -> Steps Id (Ix1, e) Source #

(Shape L (Ix (n - 1)), Index (IxN n)) => Shape L (IxN n) Source # 
Instance details

Defined in Data.Massiv.Core.List

(Shape L (IxN n), Ragged L (Ix (n - 1)) e, Coercible (Elt (Ix (n - 1)) e) (ListItem (Ix (n - 1)) e)) => Ragged L (IxN n) e Source # 
Instance details

Defined in Data.Massiv.Core.List

Methods

generateRaggedM :: Monad m => Comp -> Sz (IxN n) -> (IxN n -> m e) -> m (Array L (IxN n) e)

flattenRagged :: Array L (IxN n) e -> Vector L e

loadRaggedST :: Scheduler s () -> Array L (IxN n) e -> (Ix1 -> e -> ST s ()) -> Ix1 -> Ix1 -> Sz (IxN n) -> ST s ()

raggedFormat :: (e -> String) -> String -> Array L (IxN n) e -> String

Coercible (Elt ix e) (ListItem ix e) => IsList (Array L ix e) Source # 
Instance details

Defined in Data.Massiv.Core.List

Associated Types

type Item (Array L ix e) #

Methods

fromList :: [Item (Array L ix e)] -> Array L ix e #

fromListN :: Int -> [Item (Array L ix e)] -> Array L ix e #

toList :: Array L ix e -> [Item (Array L ix e)] #

(Ragged L ix e, Show e) => Show (Array L ix e) Source # 
Instance details

Defined in Data.Massiv.Core.List

Methods

showsPrec :: Int -> Array L ix e -> ShowS #

show :: Array L ix e -> String #

showList :: [Array L ix e] -> ShowS #

data Array L ix e Source # 
Instance details

Defined in Data.Massiv.Core.List

data Array L ix e = LArray {}
type Item (Array L ix e) Source # 
Instance details

Defined in Data.Massiv.Core.List

type Item (Array L ix e) = ListItem ix e

type family ListItem ix e :: Type where ... Source #

Equations

ListItem Ix1 e = e 
ListItem ix e = [ListItem (Lower ix) e] 

data Scheduler s a #

Main type for scheduling work. See withScheduler or withScheduler_ for ways to construct and use this data type.

Since: scheduler-1.0.0

data SchedulerWS ws a #

This is a wrapper around Scheduler, but it also keeps a separate state for each individual worker. See withSchedulerWS or withSchedulerWS_ for ways to construct and use this data type.

Since: scheduler-1.4.0

class Typeable r => Strategy r Source #

Minimal complete definition

setComp, getComp

Instances

Instances details
Strategy DI Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Interleaved

Methods

setComp :: Comp -> Array DI ix e -> Array DI ix e Source #

getComp :: Array DI ix e -> Comp Source #

repr :: DI

Strategy D Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

setComp :: Comp -> Array D ix e -> Array D ix e Source #

getComp :: Array D ix e -> Comp Source #

repr :: D

Strategy DL Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Push

Methods

setComp :: Comp -> Array DL ix e -> Array DL ix e Source #

getComp :: Array DL ix e -> Comp Source #

repr :: DL

Strategy DS Source #

For now only Seq strategy.

Instance details

Defined in Data.Massiv.Array.Delayed.Stream

Methods

setComp :: Comp -> Array DS ix e -> Array DS ix e Source #

getComp :: Array DS ix e -> Comp Source #

repr :: DS

Strategy DW Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Windowed

Methods

setComp :: Comp -> Array DW ix e -> Array DW ix e Source #

getComp :: Array DW ix e -> Comp Source #

repr :: DW

Strategy B Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

setComp :: Comp -> Array B ix e -> Array B ix e Source #

getComp :: Array B ix e -> Comp Source #

repr :: B

Strategy BL Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

setComp :: Comp -> Array BL ix e -> Array BL ix e Source #

getComp :: Array BL ix e -> Comp Source #

repr :: BL

Strategy BN Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

setComp :: Comp -> Array BN ix e -> Array BN ix e Source #

getComp :: Array BN ix e -> Comp Source #

repr :: BN

Strategy P Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

setComp :: Comp -> Array P ix e -> Array P ix e Source #

getComp :: Array P ix e -> Comp Source #

repr :: P

Strategy S Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

setComp :: Comp -> Array S ix e -> Array S ix e Source #

getComp :: Array S ix e -> Comp Source #

repr :: S

Strategy U Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

setComp :: Comp -> Array U ix e -> Array U ix e Source #

getComp :: Array U ix e -> Comp Source #

repr :: U

Strategy L Source # 
Instance details

Defined in Data.Massiv.Core.List

Methods

setComp :: Comp -> Array L ix e -> Array L ix e Source #

getComp :: Array L ix e -> Comp Source #

repr :: L

data Comp #

Computation strategy to use when scheduling work.

Constructors

Seq

Sequential computation

ParOn ![Int]

Schedule workers to run on specific capabilities. Specifying an empty list ParOn [] or using Par will result in utilization of all available capabilities.

ParN !Word16

Specify the number of workers that will be handling all the jobs. Difference from ParOn is that workers can jump between cores. Using ParN 0 will result in using all available capabilities.

Bundled Patterns

pattern Par :: Comp

Parallel computation using all available cores. Same as ParOn []

Since: scheduler-1.0.0

pattern Par' :: Comp

Parallel computation using all available cores. Same as ParN 0

Since: scheduler-1.1.0

Instances

Instances details
Monoid Comp 
Instance details

Defined in Control.Scheduler.Computation

Methods

mempty :: Comp #

mappend :: Comp -> Comp -> Comp #

mconcat :: [Comp] -> Comp #

Semigroup Comp 
Instance details

Defined in Control.Scheduler.Computation

Methods

(<>) :: Comp -> Comp -> Comp #

sconcat :: NonEmpty Comp -> Comp #

stimes :: Integral b => b -> Comp -> Comp #

Show Comp 
Instance details

Defined in Control.Scheduler.Computation

Methods

showsPrec :: Int -> Comp -> ShowS #

show :: Comp -> String #

showList :: [Comp] -> ShowS #

NFData Comp 
Instance details

Defined in Control.Scheduler.Computation

Methods

rnf :: Comp -> () #

Eq Comp 
Instance details

Defined in Control.Scheduler.Computation

Methods

(==) :: Comp -> Comp -> Bool #

(/=) :: Comp -> Comp -> Bool #

getComp :: Strategy r => Array r ix e -> Comp Source #

Get computation strategy of this array

Since: 0.1.0

setComp :: Strategy r => Comp -> Array r ix e -> Array r ix e Source #

Set computation strategy for this array

Example

Expand
>>> :set -XTypeApplications
>>> import Data.Massiv.Array
>>> a = singleton @DL @Ix1 @Int 0
>>> a
Array DL Seq (Sz1 1)
  [ 0 ]
>>> setComp (ParN 6) a -- use 6 capabilities
Array DL (ParN 6) (Sz1 1)
  [ 0 ]

appComp :: Strategy r => Comp -> Array r ix e -> Array r ix e Source #

Append computation strategy using Comp's Monoid instance.

Since: 0.6.0

data WorkerStates ws #

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 ws) -> m (WorkerStates ws) #

Initialize a separate state for each worker.

Since: scheduler-1.4.0

scheduleWork :: MonadPrimBase s m => Scheduler s a -> m a -> m () #

Schedule an action to be picked up and computed by a worker from a pool of jobs. Similar to scheduleWorkId, except the job doesn't get the worker id.

Since: scheduler-1.0.0

scheduleWork_ :: MonadPrimBase s m => Scheduler s () -> m () -> m () #

Same as scheduleWork, but only for a Scheduler that doesn't keep the results.

Since: scheduler-1.1.0

Numeric

class (Size r, Num e) => FoldNumeric r e Source #

Minimal complete definition

foldArray, powerSumArray, unsafeDotProduct

Instances

Instances details
Num e => FoldNumeric D e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

sumArray :: Index ix => Array D ix e -> e Source #

productArray :: Index ix => Array D ix e -> e Source #

powerSumArray :: Index ix => Array D ix e -> Int -> e Source #

unsafeDotProduct :: Index ix => Array D ix e -> Array D ix e -> e Source #

foldArray :: Index ix => (e -> e -> e) -> e -> Array D ix e -> e Source #

Num e => FoldNumeric B e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

sumArray :: Index ix => Array B ix e -> e Source #

productArray :: Index ix => Array B ix e -> e Source #

powerSumArray :: Index ix => Array B ix e -> Int -> e Source #

unsafeDotProduct :: Index ix => Array B ix e -> Array B ix e -> e Source #

foldArray :: Index ix => (e -> e -> e) -> e -> Array B ix e -> e Source #

Num e => FoldNumeric BL e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

sumArray :: Index ix => Array BL ix e -> e Source #

productArray :: Index ix => Array BL ix e -> e Source #

powerSumArray :: Index ix => Array BL ix e -> Int -> e Source #

unsafeDotProduct :: Index ix => Array BL ix e -> Array BL ix e -> e Source #

foldArray :: Index ix => (e -> e -> e) -> e -> Array BL ix e -> e Source #

(NFData e, Num e) => FoldNumeric BN e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

sumArray :: Index ix => Array BN ix e -> e Source #

productArray :: Index ix => Array BN ix e -> e Source #

powerSumArray :: Index ix => Array BN ix e -> Int -> e Source #

unsafeDotProduct :: Index ix => Array BN ix e -> Array BN ix e -> e Source #

foldArray :: Index ix => (e -> e -> e) -> e -> Array BN ix e -> e Source #

(Prim e, Num e) => FoldNumeric P e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

sumArray :: Index ix => Array P ix e -> e Source #

productArray :: Index ix => Array P ix e -> e Source #

powerSumArray :: Index ix => Array P ix e -> Int -> e Source #

unsafeDotProduct :: Index ix => Array P ix e -> Array P ix e -> e Source #

foldArray :: Index ix => (e -> e -> e) -> e -> Array P ix e -> e Source #

(Storable e, Num e) => FoldNumeric S e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

sumArray :: Index ix => Array S ix e -> e Source #

productArray :: Index ix => Array S ix e -> e Source #

powerSumArray :: Index ix => Array S ix e -> Int -> e Source #

unsafeDotProduct :: Index ix => Array S ix e -> Array S ix e -> e Source #

foldArray :: Index ix => (e -> e -> e) -> e -> Array S ix e -> e Source #

(Unbox e, Num e) => FoldNumeric U e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

sumArray :: Index ix => Array U ix e -> e Source #

productArray :: Index ix => Array U ix e -> e Source #

powerSumArray :: Index ix => Array U ix e -> Int -> e Source #

unsafeDotProduct :: Index ix => Array U ix e -> Array U ix e -> e Source #

foldArray :: Index ix => (e -> e -> e) -> e -> Array U ix e -> e Source #

class FoldNumeric r e => Numeric r e Source #

Minimal complete definition

unsafeLiftArray, unsafeLiftArray2

Instances

Instances details
Num e => Numeric D e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

plusScalar :: Index ix => Array D ix e -> e -> Array D ix e Source #

minusScalar :: Index ix => Array D ix e -> e -> Array D ix e Source #

scalarMinus :: Index ix => e -> Array D ix e -> Array D ix e Source #

multiplyScalar :: Index ix => Array D ix e -> e -> Array D ix e Source #

absPointwise :: Index ix => Array D ix e -> Array D ix e Source #

additionPointwise :: Index ix => Array D ix e -> Array D ix e -> Array D ix e Source #

subtractionPointwise :: Index ix => Array D ix e -> Array D ix e -> Array D ix e Source #

multiplicationPointwise :: Index ix => Array D ix e -> Array D ix e -> Array D ix e Source #

powerPointwise :: Index ix => Array D ix e -> Int -> Array D ix e Source #

unsafeLiftArray :: Index ix => (e -> e) -> Array D ix e -> Array D ix e Source #

unsafeLiftArray2 :: Index ix => (e -> e -> e) -> Array D ix e -> Array D ix e -> Array D ix e Source #

Num e => Numeric B e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

plusScalar :: Index ix => Array B ix e -> e -> Array B ix e Source #

minusScalar :: Index ix => Array B ix e -> e -> Array B ix e Source #

scalarMinus :: Index ix => e -> Array B ix e -> Array B ix e Source #

multiplyScalar :: Index ix => Array B ix e -> e -> Array B ix e Source #

absPointwise :: Index ix => Array B ix e -> Array B ix e Source #

additionPointwise :: Index ix => Array B ix e -> Array B ix e -> Array B ix e Source #

subtractionPointwise :: Index ix => Array B ix e -> Array B ix e -> Array B ix e Source #

multiplicationPointwise :: Index ix => Array B ix e -> Array B ix e -> Array B ix e Source #

powerPointwise :: Index ix => Array B ix e -> Int -> Array B ix e Source #

unsafeLiftArray :: Index ix => (e -> e) -> Array B ix e -> Array B ix e Source #

unsafeLiftArray2 :: Index ix => (e -> e -> e) -> Array B ix e -> Array B ix e -> Array B ix e Source #

Num e => Numeric BL e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

plusScalar :: Index ix => Array BL ix e -> e -> Array BL ix e Source #

minusScalar :: Index ix => Array BL ix e -> e -> Array BL ix e Source #

scalarMinus :: Index ix => e -> Array BL ix e -> Array BL ix e Source #

multiplyScalar :: Index ix => Array BL ix e -> e -> Array BL ix e Source #

absPointwise :: Index ix => Array BL ix e -> Array BL ix e Source #

additionPointwise :: Index ix => Array BL ix e -> Array BL ix e -> Array BL ix e Source #

subtractionPointwise :: Index ix => Array BL ix e -> Array BL ix e -> Array BL ix e Source #

multiplicationPointwise :: Index ix => Array BL ix e -> Array BL ix e -> Array BL ix e Source #

powerPointwise :: Index ix => Array BL ix e -> Int -> Array BL ix e Source #

unsafeLiftArray :: Index ix => (e -> e) -> Array BL ix e -> Array BL ix e Source #

unsafeLiftArray2 :: Index ix => (e -> e -> e) -> Array BL ix e -> Array BL ix e -> Array BL ix e Source #

(NFData e, Num e) => Numeric BN e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

plusScalar :: Index ix => Array BN ix e -> e -> Array BN ix e Source #

minusScalar :: Index ix => Array BN ix e -> e -> Array BN ix e Source #

scalarMinus :: Index ix => e -> Array BN ix e -> Array BN ix e Source #

multiplyScalar :: Index ix => Array BN ix e -> e -> Array BN ix e Source #

absPointwise :: Index ix => Array BN ix e -> Array BN ix e Source #

additionPointwise :: Index ix => Array BN ix e -> Array BN ix e -> Array BN ix e Source #

subtractionPointwise :: Index ix => Array BN ix e -> Array BN ix e -> Array BN ix e Source #

multiplicationPointwise :: Index ix => Array BN ix e -> Array BN ix e -> Array BN ix e Source #

powerPointwise :: Index ix => Array BN ix e -> Int -> Array BN ix e Source #

unsafeLiftArray :: Index ix => (e -> e) -> Array BN ix e -> Array BN ix e Source #

unsafeLiftArray2 :: Index ix => (e -> e -> e) -> Array BN ix e -> Array BN ix e -> Array BN ix e Source #

(Prim e, Num e) => Numeric P e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

plusScalar :: Index ix => Array P ix e -> e -> Array P ix e Source #

minusScalar :: Index ix => Array P ix e -> e -> Array P ix e Source #

scalarMinus :: Index ix => e -> Array P ix e -> Array P ix e Source #

multiplyScalar :: Index ix => Array P ix e -> e -> Array P ix e Source #

absPointwise :: Index ix => Array P ix e -> Array P ix e Source #

additionPointwise :: Index ix => Array P ix e -> Array P ix e -> Array P ix e Source #

subtractionPointwise :: Index ix => Array P ix e -> Array P ix e -> Array P ix e Source #

multiplicationPointwise :: Index ix => Array P ix e -> Array P ix e -> Array P ix e Source #

powerPointwise :: Index ix => Array P ix e -> Int -> Array P ix e Source #

unsafeLiftArray :: Index ix => (e -> e) -> Array P ix e -> Array P ix e Source #

unsafeLiftArray2 :: Index ix => (e -> e -> e) -> Array P ix e -> Array P ix e -> Array P ix e Source #

(Storable e, Num e) => Numeric S e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

plusScalar :: Index ix => Array S ix e -> e -> Array S ix e Source #

minusScalar :: Index ix => Array S ix e -> e -> Array S ix e Source #

scalarMinus :: Index ix => e -> Array S ix e -> Array S ix e Source #

multiplyScalar :: Index ix => Array S ix e -> e -> Array S ix e Source #

absPointwise :: Index ix => Array S ix e -> Array S ix e Source #

additionPointwise :: Index ix => Array S ix e -> Array S ix e -> Array S ix e Source #

subtractionPointwise :: Index ix => Array S ix e -> Array S ix e -> Array S ix e Source #

multiplicationPointwise :: Index ix => Array S ix e -> Array S ix e -> Array S ix e Source #

powerPointwise :: Index ix => Array S ix e -> Int -> Array S ix e Source #

unsafeLiftArray :: Index ix => (e -> e) -> Array S ix e -> Array S ix e Source #

unsafeLiftArray2 :: Index ix => (e -> e -> e) -> Array S ix e -> Array S ix e -> Array S ix e Source #

(Unbox e, Num e) => Numeric U e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

plusScalar :: Index ix => Array U ix e -> e -> Array U ix e Source #

minusScalar :: Index ix => Array U ix e -> e -> Array U ix e Source #

scalarMinus :: Index ix => e -> Array U ix e -> Array U ix e Source #

multiplyScalar :: Index ix => Array U ix e -> e -> Array U ix e Source #

absPointwise :: Index ix => Array U ix e -> Array U ix e Source #

additionPointwise :: Index ix => Array U ix e -> Array U ix e -> Array U ix e Source #

subtractionPointwise :: Index ix => Array U ix e -> Array U ix e -> Array U ix e Source #

multiplicationPointwise :: Index ix => Array U ix e -> Array U ix e -> Array U ix e Source #

powerPointwise :: Index ix => Array U ix e -> Int -> Array U ix e Source #

unsafeLiftArray :: Index ix => (e -> e) -> Array U ix e -> Array U ix e Source #

unsafeLiftArray2 :: Index ix => (e -> e -> e) -> Array U ix e -> Array U ix e -> Array U ix e Source #

class (Numeric r e, Floating e) => NumericFloat r e Source #

Instances

Instances details
Floating e => NumericFloat D e Source # 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

divideScalar :: Index ix => Array D ix e -> e -> Array D ix e Source #

scalarDivide :: Index ix => e -> Array D ix e -> Array D ix e Source #

divisionPointwise :: Index ix => Array D ix e -> Array D ix e -> Array D ix e Source #

recipPointwise :: Index ix => Array D ix e -> Array D ix e Source #

sqrtPointwise :: Index ix => Array D ix e -> Array D ix e Source #

(Prim e, Floating e) => NumericFloat P e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

divideScalar :: Index ix => Array P ix e -> e -> Array P ix e Source #

scalarDivide :: Index ix => e -> Array P ix e -> Array P ix e Source #

divisionPointwise :: Index ix => Array P ix e -> Array P ix e -> Array P ix e Source #

recipPointwise :: Index ix => Array P ix e -> Array P ix e Source #

sqrtPointwise :: Index ix => Array P ix e -> Array P ix e Source #

(Storable e, Floating e) => NumericFloat S e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

divideScalar :: Index ix => Array S ix e -> e -> Array S ix e Source #

scalarDivide :: Index ix => e -> Array S ix e -> Array S ix e Source #

divisionPointwise :: Index ix => Array S ix e -> Array S ix e -> Array S ix e Source #

recipPointwise :: Index ix => Array S ix e -> Array S ix e Source #

sqrtPointwise :: Index ix => Array S ix e -> Array S ix e Source #

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.

Methods

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

Instances details
MonadThrow STM 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> STM a #

MonadThrow IO 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> IO a #

MonadThrow Q 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> Q a #

MonadThrow Maybe 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> Maybe a #

MonadThrow [] 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> [a] #

e ~ SomeException => MonadThrow (Either e) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e0 => e0 -> Either e a #

MonadThrow (ST s) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> ST s a #

MonadThrow m => MonadThrow (ListT m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> ListT m a #

MonadThrow m => MonadThrow (MaybeT m)

Throws exceptions into the base monad.

Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> MaybeT m a #

(Error e, MonadThrow m) => MonadThrow (ErrorT e m)

Throws exceptions into the base monad.

Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e0 => e0 -> ErrorT e m a #

MonadThrow m => MonadThrow (ExceptT e m)

Throws exceptions into the base monad.

Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e0 => e0 -> ExceptT e m a #

MonadThrow m => MonadThrow (IdentityT m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> IdentityT m a #

MonadThrow m => MonadThrow (ReaderT r m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> ReaderT r m a #

MonadThrow m => MonadThrow (StateT s m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> StateT s m a #

MonadThrow m => MonadThrow (StateT s m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> StateT s m a #

(MonadThrow m, Monoid w) => MonadThrow (WriterT w m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> WriterT w m a #

(MonadThrow m, Monoid w) => MonadThrow (WriterT w m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> WriterT w m a #

MonadThrow m => MonadThrow (ContT r m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> ContT r m a #

(MonadThrow m, Monoid w) => MonadThrow (RWST r w s m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> RWST r w s m a #

(MonadThrow m, Monoid w) => MonadThrow (RWST r w s m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> RWST r w s m a #

data IndexException where Source #

Exceptions that get thrown when there is a problem with an index, size or dimension.

Since: 0.3.0

Constructors

IndexZeroException :: Index ix => !ix -> IndexException

Index contains a zero value along one of the dimensions.

IndexDimensionException :: (NFData ix, Eq 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.

data SizeException where Source #

Exception that indicates an issue with an array size.

Since: 0.3.0

Constructors

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.

SizeOverflowException :: Index ix => !(Sz ix) -> SizeException

Total number of elements is too large resulting in overflow.

Since: 0.6.0

SizeNegativeException :: Index ix => !(Sz ix) -> SizeException

At least one dimensions contain a negative value.

Since: 0.6.0

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

Constructors

DimTooShortException !Dim !(Sz Ix1) !(Sz Ix1)

Across a specific dimension there was not enough elements for the supplied size

DimTooLongException !Dim !(Sz Ix1) !(Sz Ix1)

Across a specific dimension there was too many elements for the supplied size

ShapeNonEmpty

Expected an empty size, but the shape was not empty.

throwImpossible :: HasCallStack => Exception e => e -> a Source #

Throw an impossible error.

Since: 0.5.6

throwEither :: HasCallStack => Either SomeException a -> a Source #

Throw an error on Left or produce the result on Right. Exception type is lost, so do not expect to be able to catch it as such. Stick to IO if you need exception control flow.

Since: 0.5.6

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.

Constructors

Uninitialized 

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

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

Minimal complete definition

Nothing

Methods

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

Instances details
Exception NestedAtomically

Since: base-4.0

Instance details

Defined in Control.Exception.Base

Exception NoMethodError

Since: base-4.0

Instance details

Defined in Control.Exception.Base

Exception NonTermination

Since: base-4.0

Instance details

Defined in Control.Exception.Base

Exception PatternMatchFail

Since: base-4.0

Instance details

Defined in Control.Exception.Base

Exception RecConError

Since: base-4.0

Instance details

Defined in Control.Exception.Base

Exception RecSelError

Since: base-4.0

Instance details

Defined in Control.Exception.Base

Exception RecUpdError

Since: base-4.0

Instance details

Defined in Control.Exception.Base

Exception TypeError

Since: base-4.9.0.0

Instance details

Defined in Control.Exception.Base

Exception Void

Since: base-4.8.0.0

Instance details

Defined in Data.Void

Exception ErrorCall

Since: base-4.0.0.0

Instance details

Defined in GHC.Exception

Exception ArithException

Since: base-4.0.0.0

Instance details

Defined in GHC.Exception.Type

Exception SomeException

Since: base-3.0

Instance details

Defined in GHC.Exception.Type

Exception AllocationLimitExceeded

Since: base-4.8.0.0

Instance details

Defined in GHC.IO.Exception

Exception ArrayException

Since: base-4.1.0.0

Instance details

Defined in GHC.IO.Exception

Exception AssertionFailed

Since: base-4.1.0.0

Instance details

Defined in GHC.IO.Exception

Exception AsyncException

Since: base-4.7.0.0

Instance details

Defined in GHC.IO.Exception

Exception BlockedIndefinitelyOnMVar

Since: base-4.1.0.0

Instance details

Defined in GHC.IO.Exception

Exception BlockedIndefinitelyOnSTM

Since: base-4.1.0.0

Instance details

Defined in GHC.IO.Exception

Exception CompactionFailed

Since: base-4.10.0.0

Instance details

Defined in GHC.IO.Exception

Exception Deadlock

Since: base-4.1.0.0

Instance details

Defined in GHC.IO.Exception

Exception ExitCode

Since: base-4.1.0.0

Instance details

Defined in GHC.IO.Exception

Exception FixIOException

Since: base-4.11.0.0

Instance details

Defined in GHC.IO.Exception

Exception IOException

Since: base-4.1.0.0

Instance details

Defined in GHC.IO.Exception

Exception SomeAsyncException

Since: base-4.7.0.0

Instance details

Defined in GHC.IO.Exception

Exception Uninitialized Source # 
Instance details

Defined in Data.Massiv.Core.Exception

Exception IndexException Source # 
Instance details

Defined in Data.Massiv.Core.Index.Internal

Exception ShapeException Source # 
Instance details

Defined in Data.Massiv.Core.Index.Internal

Exception SizeException Source # 
Instance details

Defined in Data.Massiv.Core.Index.Internal

Exception CancelBatchException 
Instance details

Defined in Control.Scheduler.Types

Methods

toException :: CancelBatchException -> SomeException #

fromException :: SomeException -> Maybe CancelBatchException #

displayException :: CancelBatchException -> String #

Exception MutexException 
Instance details

Defined in Control.Scheduler.Types

Exception TerminateEarlyException 
Instance details

Defined in Control.Scheduler.Types

Methods

toException :: TerminateEarlyException -> SomeException #

fromException :: SomeException -> Maybe TerminateEarlyException #

displayException :: TerminateEarlyException -> String #

Exception WorkerException 
Instance details

Defined in Control.Scheduler.Types

Methods

toException :: WorkerException -> SomeException #

fromException :: SomeException -> Maybe WorkerException #

displayException :: WorkerException -> String #

Exception WorkerTerminateException 
Instance details

Defined in Control.Scheduler.Types

Methods

toException :: WorkerTerminateException -> SomeException #

fromException :: SomeException -> Maybe WorkerTerminateException #

displayException :: WorkerTerminateException -> String #

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

Instances details
Exception SomeException

Since: base-3.0

Instance details

Defined in GHC.Exception.Type

Show SomeException

Since: base-3.0

Instance details

Defined in GHC.Exception.Type

type HasCallStack = ?callStack :: CallStack #

Request a CallStack.

NOTE: The implicit parameter ?callStack :: CallStack is an implementation detail and should not be considered part of the CallStack API, we may decide to change the implementation in the future.

Since: base-4.9.0.0

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 function run provided by withRunInIO, it must meet the monad transformer laws as reformulated for MonadUnliftIO:

  • run . return = return
  • run (m >>= f) = run m >>= run . f

Instances of MonadUnliftIO must also satisfy the following laws:

Identity law
withRunInIO (\run -> run m) = m
Inverse law
withRunInIO (\_ -> m) = liftIO m

As an example of an invalid instance, a naive implementation of MonadUnliftIO (StateT s m) might be

withRunInIO inner =
  StateT $ \s ->
    withRunInIO $ \run ->
      inner (run . flip evalStateT s)

This breaks the identity law because the inner run m would throw away any state changes in m.

Since: unliftio-core-0.1.0.0

Minimal complete definition

withRunInIO

Instances

Instances details
MonadUnliftIO IO 
Instance details

Defined in Control.Monad.IO.Unlift

Methods

withRunInIO :: ((forall a. IO a -> IO a) -> IO b) -> IO b #

MonadUnliftIO m => MonadUnliftIO (IdentityT m) 
Instance details

Defined in Control.Monad.IO.Unlift

Methods

withRunInIO :: ((forall a. IdentityT m a -> IO a) -> IO b) -> IdentityT m b #

MonadUnliftIO m => MonadUnliftIO (ReaderT r m) 
Instance details

Defined in Control.Monad.IO.Unlift

Methods

withRunInIO :: ((forall a. ReaderT r m a -> IO a) -> IO b) -> ReaderT r m b #

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:

Methods

liftIO :: IO a -> m a #

Lift a computation from the IO monad. This allows us to run IO computations in any monadic stack, so long as it supports these kinds of operations (i.e. IO is the base monad for the stack).

Example

Expand
import Control.Monad.Trans.State -- from the "transformers" library

printState :: Show s => StateT s IO ()
printState = do
  state <- get
  liftIO $ print state

Had we omitted liftIO, we would have ended up with this error:

• Couldn't match type ‘IO’ with ‘StateT s IO’
 Expected type: StateT s IO ()
   Actual type: IO ()

The important part here is the mismatch between StateT s IO () and IO ().

Luckily, we know of a function that takes an IO a and returns an (m a): liftIO, enabling us to run the program and see the expected results:

> evalStateT printState "hello"
"hello"

> evalStateT printState 3
3

Instances

Instances details
MonadIO IO

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.IO.Class

Methods

liftIO :: IO a -> IO a #

MonadIO Q 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

liftIO :: IO a -> Q a #

MonadIO m => MonadIO (ListT m) 
Instance details

Defined in Control.Monad.Trans.List

Methods

liftIO :: IO a -> ListT m a #

MonadIO m => MonadIO (MaybeT m) 
Instance details

Defined in Control.Monad.Trans.Maybe

Methods

liftIO :: IO a -> MaybeT m a #

(Monoid w, Functor m, MonadIO m) => MonadIO (AccumT w m) 
Instance details

Defined in Control.Monad.Trans.Accum

Methods

liftIO :: IO a -> AccumT w m a #

(Error e, MonadIO m) => MonadIO (ErrorT e m) 
Instance details

Defined in Control.Monad.Trans.Error

Methods

liftIO :: IO a -> ErrorT e m a #

MonadIO m => MonadIO (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftIO :: IO a -> ExceptT e m a #

MonadIO m => MonadIO (IdentityT m) 
Instance details

Defined in Control.Monad.Trans.Identity

Methods

liftIO :: IO a -> IdentityT m a #

MonadIO m => MonadIO (ReaderT r m) 
Instance details

Defined in Control.Monad.Trans.Reader

Methods

liftIO :: IO a -> ReaderT r m a #

MonadIO m => MonadIO (SelectT r m) 
Instance details

Defined in Control.Monad.Trans.Select

Methods

liftIO :: IO a -> SelectT r m a #

MonadIO m => MonadIO (StateT s m) 
Instance details

Defined in Control.Monad.Trans.State.Lazy

Methods

liftIO :: IO a -> StateT s m a #

MonadIO m => MonadIO (StateT s m) 
Instance details

Defined in Control.Monad.Trans.State.Strict

Methods

liftIO :: IO a -> StateT s m a #

MonadIO m => MonadIO (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.CPS

Methods

liftIO :: IO a -> WriterT w m a #

(Monoid w, MonadIO m) => MonadIO (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

liftIO :: IO a -> WriterT w m a #

(Monoid w, MonadIO m) => MonadIO (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Strict

Methods

liftIO :: IO a -> WriterT w m a #

MonadIO m => MonadIO (ContT r m) 
Instance details

Defined in Control.Monad.Trans.Cont

Methods

liftIO :: IO a -> ContT r m a #

MonadIO m => MonadIO (RWST r w s m) 
Instance details

Defined in Control.Monad.Trans.RWS.CPS

Methods

liftIO :: IO a -> RWST r w s m a #

(Monoid w, MonadIO m) => MonadIO (RWST r w s m) 
Instance details

Defined in Control.Monad.Trans.RWS.Lazy

Methods

liftIO :: IO a -> RWST r w s m a #

(Monoid w, MonadIO m) => MonadIO (RWST r w s m) 
Instance details

Defined in Control.Monad.Trans.RWS.Strict

Methods

liftIO :: IO a -> RWST r w s m a #

class Monad m => PrimMonad (m :: Type -> Type) #

Class of monads which can perform primitive state-transformer actions.

Minimal complete definition

primitive

Associated Types

type PrimState (m :: Type -> Type) #

State token type.

Instances

Instances details
PrimMonad IO 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState IO #

Methods

primitive :: (State# (PrimState IO) -> (# State# (PrimState IO), a #)) -> IO a #

PrimMonad (ST s) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ST s) #

Methods

primitive :: (State# (PrimState (ST s)) -> (# State# (PrimState (ST s)), a #)) -> ST s a #

PrimMonad (ST s) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ST s) #

Methods

primitive :: (State# (PrimState (ST s)) -> (# State# (PrimState (ST s)), a #)) -> ST s a #

PrimMonad m => PrimMonad (ListT m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ListT m) #

Methods

primitive :: (State# (PrimState (ListT m)) -> (# State# (PrimState (ListT m)), a #)) -> ListT m a #

PrimMonad m => PrimMonad (MaybeT m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (MaybeT m) #

Methods

primitive :: (State# (PrimState (MaybeT m)) -> (# State# (PrimState (MaybeT m)), a #)) -> MaybeT m a #

(Monoid w, PrimMonad m) => PrimMonad (AccumT w m)

Since: primitive-0.6.3.0

Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (AccumT w m) #

Methods

primitive :: (State# (PrimState (AccumT w m)) -> (# State# (PrimState (AccumT w m)), a #)) -> AccumT w m a #

(Error e, PrimMonad m) => PrimMonad (ErrorT e m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ErrorT e m) #

Methods

primitive :: (State# (PrimState (ErrorT e m)) -> (# State# (PrimState (ErrorT e m)), a #)) -> ErrorT e m a #

PrimMonad m => PrimMonad (ExceptT e m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ExceptT e m) #

Methods

primitive :: (State# (PrimState (ExceptT e m)) -> (# State# (PrimState (ExceptT e m)), a #)) -> ExceptT e m a #

PrimMonad m => PrimMonad (IdentityT m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (IdentityT m) #

Methods

primitive :: (State# (PrimState (IdentityT m)) -> (# State# (PrimState (IdentityT m)), a #)) -> IdentityT m a #

PrimMonad m => PrimMonad (ReaderT r m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ReaderT r m) #

Methods

primitive :: (State# (PrimState (ReaderT r m)) -> (# State# (PrimState (ReaderT r m)), a #)) -> ReaderT r m a #

PrimMonad m => PrimMonad (SelectT r m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (SelectT r m) #

Methods

primitive :: (State# (PrimState (SelectT r m)) -> (# State# (PrimState (SelectT r m)), a #)) -> SelectT r m a #

PrimMonad m => PrimMonad (StateT s m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (StateT s m) #

Methods

primitive :: (State# (PrimState (StateT s m)) -> (# State# (PrimState (StateT s m)), a #)) -> StateT s m a #

PrimMonad m => PrimMonad (StateT s m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (StateT s m) #

Methods

primitive :: (State# (PrimState (StateT s m)) -> (# State# (PrimState (StateT s m)), a #)) -> StateT s m a #

(Monoid w, PrimMonad m) => PrimMonad (WriterT w m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (WriterT w m) #

Methods

primitive :: (State# (PrimState (WriterT w m)) -> (# State# (PrimState (WriterT w m)), a #)) -> WriterT w m a #

(Monoid w, PrimMonad m) => PrimMonad (WriterT w m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (WriterT w m) #

Methods

primitive :: (State# (PrimState (WriterT w m)) -> (# State# (PrimState (WriterT w m)), a #)) -> WriterT w m a #

(Monoid w, PrimMonad m) => PrimMonad (WriterT w m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (WriterT w m) #

Methods

primitive :: (State# (PrimState (WriterT w m)) -> (# State# (PrimState (WriterT w m)), a #)) -> WriterT w m a #

PrimMonad m => PrimMonad (ContT r m)

Since: primitive-0.6.3.0

Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ContT r m) #

Methods

primitive :: (State# (PrimState (ContT r m)) -> (# State# (PrimState (ContT r m)), a #)) -> ContT r m a #

(Monoid w, PrimMonad m) => PrimMonad (RWST r w s m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (RWST r w s m) #

Methods

primitive :: (State# (PrimState (RWST r w s m)) -> (# State# (PrimState (RWST r w s m)), a #)) -> RWST r w s m a #

(Monoid w, PrimMonad m) => PrimMonad (RWST r w s m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (RWST r w s m) #

Methods

primitive :: (State# (PrimState (RWST r w s m)) -> (# State# (PrimState (RWST r w s m)), a #)) -> RWST r w s m a #

(Monoid w, PrimMonad m) => PrimMonad (RWST r w s m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (RWST r w s m) #

Methods

primitive :: (State# (PrimState (RWST r w s m)) -> (# State# (PrimState (RWST r w s m)), a #)) -> RWST r w s m a #