HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulelinear-base-0.4.0Haskell2010

Data.Array.Polarized.Pull

This module provides pull arrays.

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

  • 1 type
  • 15 values
datadata Array a where
#

A pull array is an array from which it is easy to extract elements, and this can be done in any order. The linear consumption of a pull array means each element is consumed exactly once, but the length can be accessed freely.

Instances3Functor, Semigroup
  • Functor ArrayDefined in linear-base-0.4.0 · Data.Array.Polarized.Pull.Internal
  • Semigroup (Array a)Defined in linear-base-0.4.0 · Data.Array.Polarized.Pull.Internal
  • Semigroup (Array a)Defined in linear-base-0.4.0 · Data.Array.Polarized.Pull.Internal

Construction

4 declarations
valuefromFunction :: (Int -> a) -> Int -> Array a
#

fromFunction arrIndexer len constructs a pull array given a function arrIndexer that goes from an array index to array values and a specified length len.

valuemake :: a -> Int -> Array a
#

Creates a pull array of given size, filled with the given element.

valuesingleton :: a %1 -> Array a
#

Produce a pull array of lenght 1 consisting of solely the given element.

Consumption

2 declarations
valueasList :: Array a %1 -> [a]
#

Convert a pull array into a list.

Operations

9 declarations
valuezip :: Array a %1 -> Array b %1 -> Array (a, b)
#

zip [x1, ..., xn] [y1, ..., yn] = [(x1,y1), ..., (xn,yn)] Partial: `zip [x1,x2,...,xn] [y1,y2,...,yp]` is an error if n ≠ p.

valuezipWith :: (a %1 -> b %1 -> c) -> Array a %1 -> Array b %1 -> Array c
#

zipWith f [x1,x2,...,xn] [y1,y2,...,yn] = [f x1 y1, ..., f xn yn] Partial: `zipWith f [x1,x2,...,xn] [y1,y2,...,yp]` is an error if n ≠ p.

valuefoldr :: (a %1 -> b %1 -> b) -> b %1 -> Array a %1 -> b
#

A right-fold of a pull array.

valuefoldMap :: Monoid m => (a %1 -> m) -> Array a %1 -> m
#

Fold a pull array using a monoid.

valuesplit :: Int -> Array a %1 -> (Array a, Array a)
#

split n v = (vl, vr) such that vl has length n.

split is total: if n is larger than the length of v, then vr is empty.

valueindex :: Array a %1 -> Int -> (a, Array a)
#

Index a pull array (without checking bounds)