-- 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.3.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 null :: Contiguous arr => arr b -> Bool new :: (Contiguous arr, PrimMonad m, Element arr b) => Int -> m (Mutable arr (PrimState m) b) replicateM :: (Contiguous arr, PrimMonad m, Element arr b) => Int -> b -> m (Mutable arr (PrimState m) 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, PrimMonad m, Element arr b) => Mutable arr (PrimState m) b -> Int -> m b write :: (Contiguous arr, PrimMonad m, Element arr b) => Mutable arr (PrimState m) b -> Int -> b -> m () resize :: (Contiguous arr, PrimMonad m, Element arr b) => Mutable arr (PrimState m) b -> Int -> m (Mutable arr (PrimState m) b) size :: (Contiguous arr, Element arr b) => arr b -> Int sizeMutable :: (Contiguous arr, PrimMonad m, Element arr b) => Mutable arr (PrimState m) b -> m Int unsafeFreeze :: (Contiguous arr, PrimMonad m) => Mutable arr (PrimState m) b -> m (arr b) copy :: (Contiguous arr, PrimMonad m, Element arr b) => Mutable arr (PrimState m) b -> Int -> arr b -> Int -> Int -> m () copyMutable :: (Contiguous arr, PrimMonad m, Element arr b) => Mutable arr (PrimState m) b -> Int -> Mutable arr (PrimState m) b -> Int -> Int -> m () clone :: (Contiguous arr, Element arr b) => arr b -> Int -> Int -> arr b cloneMutable :: (Contiguous arr, PrimMonad m, Element arr b) => Mutable arr (PrimState m) b -> Int -> Int -> m (Mutable arr (PrimState m) 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 sameMutable :: Contiguous arr => Mutable arr s a -> Mutable arr s a -> Bool rnf :: (Contiguous arr, NFData a, Element arr a) => arr a -> () -- | A typeclass that is satisfied by all types. This is used used to -- provide a fake constraint for Array and SmallArray. class Always a -- | Map over the elements of an array. map :: (Contiguous arr1, Element arr1 b, Contiguous arr2, Element arr2 c) => (b -> c) -> arr1 b -> arr2 c -- | Right fold over the element of an array. foldr :: (Contiguous arr, Element arr a) => (a -> b -> b) -> b -> arr a -> b -- | Monoidal fold over the element of an array. foldMap :: (Contiguous arr, Element arr a, Monoid m) => (a -> m) -> arr a -> m -- | 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 traverse_ :: (Contiguous arr, Element arr a, Applicative f) => (a -> f b) -> arr a -> f () itraverse_ :: (Contiguous arr, Element arr a, Applicative f) => (Int -> a -> f b) -> arr a -> f () -- | 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 liftHashWithSalt :: (Contiguous arr, Element arr a) => (Int -> a -> Int) -> Int -> arr a -> Int -- | This function does not behave deterministically. Optimization level -- and inlining can affect its results. However, the one thing that can -- be counted on is that if it returns True, the two immutable -- arrays are definitely the same. This is useful as shortcut for -- equality tests. However, keep in mind that a result of False -- tells us nothing about the arguments. same :: Contiguous arr => arr a -> arr a -> Bool 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