linear-base-0.4.0: Standard library for linear types.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Array.Polarized.Push

Description

This module provides push arrays.

These are part of a larger framework for controlling when memory is allocated for an array. See Data.Array.Polarized.

This module is designed to be imported qualified as Push.

Synopsis

Construction

data Array a where Source #

Push arrays are un-allocated finished arrays. These are finished computations passed along or enlarged until we are ready to allocate.

Constructors

Array :: (forall m. Monoid m => (a -> m) -> m) -> Array a 

Instances

Instances details
Functor Array Source # 
Instance details

Defined in Data.Array.Polarized.Push

Methods

fmap :: (a %1 -> b) -> Array a %1 -> Array b Source #

Monoid (Array a) Source # 
Instance details

Defined in Data.Array.Polarized.Push

Methods

mempty :: Array a #

mappend :: Array a -> Array a -> Array a #

mconcat :: [Array a] -> Array a #

Semigroup (Array a) Source # 
Instance details

Defined in Data.Array.Polarized.Push

Methods

(<>) :: Array a -> Array a -> Array a #

sconcat :: NonEmpty (Array a) -> Array a #

stimes :: Integral b => b -> Array a -> Array a #

Monoid (Array a) Source # 
Instance details

Defined in Data.Array.Polarized.Push

Methods

mempty :: Array a Source #

Semigroup (Array a) Source # 
Instance details

Defined in Data.Array.Polarized.Push

Methods

(<>) :: Array a %1 -> Array a %1 -> Array a Source #

make :: HasCallStack => a -> Int -> Array a Source #

make x n creates a constant push array of length n in which every element is x.

cons :: a -> Array a %1 -> Array a Source #

snoc :: a -> Array a %1 -> Array a Source #

Operations

alloc :: Array a %1 -> Vector a Source #

Convert a push array into a vector by allocating. This would be a common end to a computation using push and pull arrays.

foldMap :: Monoid b => (a -> b) -> Array a %1 -> b Source #

unzip :: Array (a, b) %1 -> (Array a, Array b) Source #