-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Unified interface for primitive arrays
--
-- This package provides a typeclass Contiguous that offers a
-- unified interface to working with Array, PrimArray, and
-- UnliftedArray.
@package contiguous
@version 0.2.0.0
module Data.Primitive.Contiguous
-- | A contiguous array of elements.
class Contiguous (arr :: Type -> Type) where {
type family Mutable arr = (r :: Type -> Type -> Type) | r -> arr;
type family Element arr :: Type -> Constraint;
}
empty :: Contiguous arr => arr a
new :: (Contiguous arr, Element arr b) => Int -> ST s (Mutable arr s b)
index :: (Contiguous arr, Element arr b) => arr b -> Int -> b
index# :: (Contiguous arr, Element arr b) => arr b -> Int -> (# b #)
indexM :: (Contiguous arr, Element arr b, Monad m) => arr b -> Int -> m b
read :: (Contiguous arr, Element arr b) => Mutable arr s b -> Int -> ST s b
write :: (Contiguous arr, Element arr b) => Mutable arr s b -> Int -> b -> ST s ()
resize :: (Contiguous arr, Element arr b) => Mutable arr s b -> Int -> ST s (Mutable arr s b)
size :: (Contiguous arr, Element arr b) => arr b -> Int
sizeMutable :: (Contiguous arr, Element arr b) => Mutable arr s b -> ST s Int
unsafeFreeze :: Contiguous arr => Mutable arr s b -> ST s (arr b)
copy :: (Contiguous arr, Element arr b) => Mutable arr s b -> Int -> arr b -> Int -> Int -> ST s ()
copyMutable :: (Contiguous arr, Element arr b) => Mutable arr s b -> Int -> Mutable arr s b -> Int -> Int -> ST s ()
clone :: (Contiguous arr, Element arr b) => arr b -> Int -> Int -> arr b
cloneMutable :: (Contiguous arr, Element arr b) => Mutable arr s b -> Int -> Int -> ST s (Mutable arr s b)
equals :: (Contiguous arr, Element arr b, Eq b) => arr b -> arr b -> Bool
unlift :: Contiguous arr => arr b -> ArrayArray#
lift :: Contiguous arr => ArrayArray# -> arr b
class Always a
-- | Map over the elements of an array.
map :: (Contiguous arr, Element arr b, Element arr c) => (b -> c) -> arr b -> arr c
-- | Right fold over the element of an array.
foldr :: (Contiguous arr, Element arr a) => (a -> b -> b) -> b -> arr a -> b
-- | Strict left fold over the elements of an array.
foldl' :: (Contiguous arr, Element arr a) => (b -> a -> b) -> b -> arr a -> b
-- | Strict right fold over the elements of an array.
foldr' :: (Contiguous arr, Element arr a) => (a -> b -> b) -> b -> arr a -> b
-- | Strict monoidal fold over the elements of an array.
foldMap' :: (Contiguous arr, Element arr a, Monoid m) => (a -> m) -> arr a -> m
-- | Strict left monadic fold over the elements of an array.
foldlM' :: (Contiguous arr, Element arr a, Monad m) => (b -> a -> m b) -> b -> arr a -> m b
-- | Create an array from a list. If the given length does not match the
-- actual length, this function has undefined behavior.
unsafeFromListN :: (Contiguous arr, Element arr a) => Int -> [a] -> arr a
-- | Create an array from a list, reversing the order of the elements. If
-- the given length does not match the actual length, this function has
-- undefined behavior.
unsafeFromListReverseN :: (Contiguous arr, Element arr a) => Int -> [a] -> arr a
instance Data.Primitive.Contiguous.Contiguous Data.Primitive.PrimArray.PrimArray
instance Data.Primitive.Contiguous.Contiguous Data.Primitive.Array.Array
instance Data.Primitive.Contiguous.Contiguous Data.Primitive.UnliftedArray.UnliftedArray
instance Data.Primitive.Contiguous.Always a