comfort-array-0.5.5: Arrays where the index type is a function of the shape type
Safe HaskellSafe-Inferred
LanguageHaskell98

Data.Array.Comfort.Boxed.Unchecked

Synopsis

Documentation

data Array sh a Source #

Constructors

Array 

Fields

Instances

Instances details
C sh => Foldable (Array sh) Source # 
Instance details

Defined in Data.Array.Comfort.Boxed.Unchecked

Methods

fold :: Monoid m => Array sh m -> m #

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

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

foldr :: (a -> b -> b) -> b -> Array sh a -> b #

foldr' :: (a -> b -> b) -> b -> Array sh a -> b #

foldl :: (b -> a -> b) -> b -> Array sh a -> b #

foldl' :: (b -> a -> b) -> b -> Array sh a -> b #

foldr1 :: (a -> a -> a) -> Array sh a -> a #

foldl1 :: (a -> a -> a) -> Array sh a -> a #

toList :: Array sh a -> [a] #

null :: Array sh a -> Bool #

length :: Array sh a -> Int #

elem :: Eq a => a -> Array sh a -> Bool #

maximum :: Ord a => Array sh a -> a #

minimum :: Ord a => Array sh a -> a #

sum :: Num a => Array sh a -> a #

product :: Num a => Array sh a -> a #

C sh => Traversable (Array sh) Source # 
Instance details

Defined in Data.Array.Comfort.Boxed.Unchecked

Methods

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

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

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

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

Static sh => Applicative (Array sh) Source #

We must restrict Applicative to Static because of pure. Because the shape is static, we do not need a size check in (<*>).

Instance details

Defined in Data.Array.Comfort.Boxed.Unchecked

Methods

pure :: a -> Array sh a #

(<*>) :: Array sh (a -> b) -> Array sh a -> Array sh b #

liftA2 :: (a -> b -> c) -> Array sh a -> Array sh b -> Array sh c #

(*>) :: Array sh a -> Array sh b -> Array sh b #

(<*) :: Array sh a -> Array sh b -> Array sh a #

C sh => Functor (Array sh) Source # 
Instance details

Defined in Data.Array.Comfort.Boxed.Unchecked

Methods

fmap :: (a -> b) -> Array sh a -> Array sh b #

(<$) :: a -> Array sh b -> Array sh a #

(C sh, Show sh, Show a) => Show (Array sh a) Source # 
Instance details

Defined in Data.Array.Comfort.Boxed.Unchecked

Methods

showsPrec :: Int -> Array sh a -> ShowS #

show :: Array sh a -> String #

showList :: [Array sh a] -> ShowS #

(C sh, NFData sh, NFData a) => NFData (Array sh a) Source # 
Instance details

Defined in Data.Array.Comfort.Boxed.Unchecked

Methods

rnf :: Array sh a -> () #

(Eq sh, Eq a) => Eq (Array sh a) Source # 
Instance details

Defined in Data.Array.Comfort.Boxed.Unchecked

Methods

(==) :: Array sh a -> Array sh a -> Bool #

(/=) :: Array sh a -> Array sh a -> Bool #

reshape :: sh1 -> Array sh0 a -> Array sh1 a Source #

mapShape :: (sh0 -> sh1) -> Array sh0 a -> Array sh1 a Source #

(!) :: Indexed sh => Array sh a -> Index sh -> a infixl 9 Source #

toList :: C sh => Array sh a -> [a] Source #

fromList :: C sh => sh -> [a] -> Array sh a Source #

replicate :: C sh => sh -> a -> Array sh a Source #

map :: C sh => (a -> b) -> Array sh a -> Array sh b Source #

zipWith :: C sh => (a -> b -> c) -> Array sh a -> Array sh b -> Array sh c Source #

append :: (C shx, C shy) => Array shx a -> Array shy a -> Array (shx ::+ shy) a infixr 5 Source #

take :: Integral n => n -> Array (ZeroBased n) a -> Array (ZeroBased n) a Source #

\(QC.NonNegative n) (ArrayChar x)  ->  x == Array.mapShape (Shape.ZeroBased . Shape.size) (Array.append (Array.take n x) (Array.drop n x))

drop :: Integral n => n -> Array (ZeroBased n) a -> Array (ZeroBased n) a Source #

\(QC.NonNegative n) (ArrayChar x)  ->  x == Array.mapShape (Shape.ZeroBased . Shape.size) (Array.append (Array.take n x) (Array.drop n x))

takeLeft :: (C sh0, C sh1) => Array (sh0 ::+ sh1) a -> Array sh0 a Source #

\(ArrayChar x) (ArrayChar y) -> let xy = Array.append x y in x == Array.takeLeft xy  &&  y == Array.takeRight xy

takeRight :: (C sh0, C sh1) => Array (sh0 ::+ sh1) a -> Array sh1 a Source #

split :: (C sh0, C sh1) => Array (sh0 ::+ sh1) a -> (Array sh0 a, Array sh1 a) Source #

takeCenter :: (C sh0, C sh1, C sh2) => Array (sh0 ::+ (sh1 ::+ sh2)) a -> Array sh1 a Source #

\(ArrayChar x) (ArrayChar y) (ArrayChar z) -> let xyz = Array.append x $ Array.append y z in y == Array.takeCenter xyz