-
data AElem a
-
Wrapper layer that allows lazy semantics for array elements what is not possible when using Frege's types that correspond to Java primitive types.
Constructors
-
AE () a
-
-
data Array i e
-
The type of immutable non-strict arrays with indices in i and elements in e.
Constructors
-
Array {lower ∷ i, upper ∷ i, cache ∷ Int, aelems ∷ JArray (AElem e)}
-
Member Functions
-
aelems ∷ Array α β → JArray (AElem β)
-
elements of array
-
assocs ∷ Ix i ⇒ Array i e → [(i, e)]
-
The list of associations of an array in index order.
-
bounds ∷ Ix i ⇒ Array i e → (i, i)
-
The bounds with which an array was constructed.
-
cache ∷ Array α β → Int
-
cached size of array
-
elems ∷ Ix i ⇒ Array i e → [e]
-
The list of elements of an array in index order.
-
indices ∷ Ix i ⇒ Array i e → [i]
-
The list of indices of an array in ascending order.
-
lower ∷ Array α β → α
-
the index lower bound
-
numElements ∷ Ix i ⇒ Array i e → Int
-
The number of elements in the array.
-
unsafeAt ∷ Ix i ⇒ Array i e → Int → e
-
Gets n-th value bypassing indexing
-
upper ∷ Array α β → α
-
the index upper bound
-
data STArray s i e
-
Mutable, non-strict arrays in the ST monad.
Constructors
-
STArray {lower ∷ i, upper ∷ i, cache ∷ Int, aelems ∷ ArrayOf s (AElem e)}
-
Member Functions
-
aelems ∷ STArray α β γ → ArrayOf α (AElem γ)
-
elements of array
-
bounds ∷ STArray s i e → (i, i)
-
The bounds with which an array was constructed.
-
cache ∷ STArray α β γ → Int
-
cached size of array
-
lower ∷ STArray β α γ → α
-
the index lower bound
-
new ∷ Ix i ⇒ (i, i) → e → ST s (STArray s i e)
-
Construct STArray with indexed between given bounds and filled with initial value
-
numElements ∷ STArray s i e → Int
-
The number of elements in the array.
-
read ∷ Ix i ⇒ STArray s i e → i → ST s e
-
Get value at given index
-
upper ∷ STArray β α γ → α
-
the index upper bound
-
write ∷ Ix i ⇒ STArray s i e → i → e → ST s ()
-
Set value at given index
-
array ∷ Ix i ⇒ (i, i) → [(i, e)] → Array i e
-
Construct an array with the specified bounds and containing values for given indices within these bounds.
If some index is present more then once in association list then value will be the last association with that index in the list. If some index is absent in association list then value for that index will (lazily) evaluate to the bottom.
Bounds argument and indices in association list are strictly evaluated in order to validate indices.
-
listArray ∷ Ix i ⇒ (i, i) → [e] → Array i e
-
Construct an array from a pair of bounds and a list of values in index order.
-
!! ∷ Ix i ⇒ Array i e → i → e
infixl 9
-
The value at the given index in an array.
-
foldrElems ∷ Ix i ⇒ (a → b → b) → b → Array i a → b
-
A right fold over the elements.
-
foldlElems ∷ Ix i ⇒ (b → a → b) → b → Array i a → b
-
A left fold over the elements.
-
foldrElems' ∷ Ix i ⇒ (a → b → b) → b → Array i a → b
-
A strict right fold over the elements.
-
foldlElems' ∷ Ix i ⇒ (b → a → b) → b → Array i a → b
-
A strict left fold over the elements.
-
foldl1Elems ∷ Ix i ⇒ (a → a → a) → Array i a → a
-
A left fold over the elements with no starting value.
-
foldr1Elems ∷ Ix i ⇒ (a → a → a) → Array i a → a
-
A right fold over the elements with no starting value.
-
accumArray ∷ Ix i ⇒ (e → a → e) → e → (i, i) → [(i, a)] → Array i e
-
The accumArray function deals with repeated indices in the association list using an /accumulating function/ which combines the values of associations with the same index. For example, given a list of values of some index type, hist produces a histogram of the number of occurrences of each index within a specified range:
hist :: (Ix a, Num b) => (a,a) -> [a] -> Array a b
hist bnds is = accumArray (+) 0 bnds [(i, 1) | i<-is, Ix.inRange bnds i]
If the accumulating function is strict, then accumArray is strict in the values, as well as the indices, in the association list. Thus, unlike ordinary arrays built with array, accumulated arrays should not in general be recursive.
-
// ∷ Ix i ⇒ Array i e → [(i, e)] → Array i e
infixl 9
-
Constructs an array identical to the first argument except that it has been updated by the associations in the right argument. For example, if m is a 1-origin, n by n matrix, then
m//[((i,i), 0) | i <- [1..n]]
is the same matrix, except with the diagonal zeroed.
Repeated indices in the association list are handled as for array.
-
accum ∷ Ix i ⇒ (e → a → e) → Array i e → [(i, a)] → Array i e
-
accum f takes an array and an association list and accumulates pairs from the list into the array with the accumulating function f. Thus accumArray can be defined using accum:
accumArray f z b = accum f (array b [(i, z) | i <- range b])
-
amap ∷ Ix i ⇒ (a → b) → Array i a → Array i b
-
Map elements with function
-
ixmap ∷ (Ix i, Ix j) ⇒ (i, i) → (i → j) → Array j e → Array i e
-
ixmap allows for transformations on array indices. It may be thought of as providing function composition on the right with the mapping that the original array embodies.
A similar transformation of array values may be achieved using Functor.fmap from the Array instance of the Functor class.
-
appPrec ∷ Int
-
-
appPrec1 ∷ Int
-
-
thawSTArray ∷ Ix i ⇒ Array i e → ST s (STArray s i e)
-
Create mutable copy of an array
-
freezeSTArray ∷ Ix i ⇒ STArray s i e → ST s (Array i e)
-
Create immutable copy of an array
-
Int
-
appPrec, appPrec1
-
JArray (AElem α) → Int → AElem α
-
ArrayElement_AElem.elemAt
-
JArray (AElem α) → Int → Maybe (AElem α)
-
ArrayElement_AElem.itemAt
-
JArray (AElem α) → [AElem α]
-
ArrayElement_AElem.listFromArray
-
JArray (AElem α) → [Maybe (AElem α)]
-
ArrayElement_AElem.maybeListFromArray
-
JArray (AElem α) → Int
-
ArrayElement_AElem.arrayLength
-
[(Int, AElem α)] → JArray (AElem α)
-
ArrayElement_AElem.arrayFromIndexList
-
[AElem α] → JArray (AElem α)
-
ArrayElement_AElem.arrayFromList
-
[Maybe (AElem α)] → JArray (AElem α)
-
ArrayElement_AElem.arrayFromMaybeList
-
() → a → AElem a
-
AElem.AE
-
α → Bool
-
Array.has$upper, Array.has$cache, Array.has$lower, Array.has$aelems, STArray.has$lower, STArray.has$aelems, STArray.has$cache, STArray.has$upper
-
Eq α ⇒ AElem α → AElem α → Bool
-
Eq_AElem.!=, Eq_AElem.==
-
Eq α ⇒ AElem α → Int
-
Eq_AElem.hashCode
-
Class (AElem α)
-
ArrayElement_AElem.javaClass
-
(AElem α → AElem α) → ArrayOf β (AElem α) → Int → ST β ()
-
ArrayElement_AElem.modifyElemAt, ArrayElement_AElem.modifyAt
-
Array α β → (Int→Int) → Array α β
-
Array.chg$cache
-
Array α β → (α→α) → Array α β
-
Array.chg$lower
-
Array α β → Int → Array α β
-
Array.upd$cache
-
Array α β → α → Array α β
-
Array.upd$upper, Array.upd$lower
-
Array α β → JArray (AElem β)
-
Array.aelems
-
Array α β → Int
-
Array.cache
-
Array α β → α
-
Array.upper, Array.lower
-
Array β α → (β→β) → Array β α
-
Array.chg$upper
-
ArrayOf β (AElem α) → Int → AElem α → ST β ()
-
ArrayElement_AElem.setElemAt
-
ArrayOf β (AElem α) → Int → Maybe (AElem α) → ST β ()
-
ArrayElement_AElem.setAt
-
ArrayOf β (AElem α) → Int → ST β (AElem α)
-
ArrayElement_AElem.getElemAt
-
ArrayOf β (AElem α) → Int → ST β (Maybe (AElem α))
-
ArrayElement_AElem.getAt
-
[(Int, AElem α)] → STMutable β (JArray (AElem α))
-
ArrayElement_AElem.arrayFromIndexListST
-
[AElem α] → STMutable β (JArray (AElem α))
-
ArrayElement_AElem.arrayFromListST
-
[Maybe (AElem α)] → STMutable β (JArray (AElem α))
-
ArrayElement_AElem.arrayFromMaybeListST
-
Int → STMutable β (JArray (AElem α))
-
ArrayElement_AElem.newArray
-
i → i → Int → JArray (AElem e) → Array i e
-
Array.Array
-
Ix i ⇒ (a → a → a) → Array i a → a
-
foldl1Elems, foldr1Elems
-
Ix i ⇒ Array i e → [(i, e)] → Array i e
-
//
-
Ix i ⇒ Array i e → Int → e
-
Array.unsafeAt
-
Ix i ⇒ Array i e → i → e
-
!!
-
Ix i ⇒ Array i e → (i, i)
-
Array.bounds
-
Ix i ⇒ Array i e → [(i, e)]
-
Array.assocs
-
Ix i ⇒ Array i e → [e]
-
Array.elems
-
Ix i ⇒ Array i e → [i]
-
Array.indices
-
Ix i ⇒ Array i e → Int
-
Array.numElements
-
Ix i ⇒ (i, i) → [(i, e)] → Array i e
-
array
-
Ix i ⇒ (i, i) → [e] → Array i e
-
listArray
-
(Ix β, Eq α) ⇒ Array β α → Array β α → Bool
-
Eq_Array.!=, Eq_Array.==
-
(Ix β, Eq α) ⇒ Array β α → Int
-
Eq_Array.hashCode
-
(Ix β, Ord α) ⇒ Array β α → Array β α → Array β α
-
Ord_Array.min, Ord_Array.max
-
(Ix β, Ord α) ⇒ Array β α → Array β α → Bool
-
Ord_Array.>=, Ord_Array.<, Ord_Array.<=, Ord_Array.>
-
(Ix β, Ord α) ⇒ Array β α → Array β α → Ordering
-
Ord_Array.compare, Ord_Array.<=>
-
(Ix β, Show β, Show α) ⇒ Array β α → String
-
Show_Array.showsub, Show_Array.display, Show_Array.show
-
(Ix β, Show β, Show α) ⇒ Array β α → [Char]
-
Show_Array.showChars
-
(Ix β, Show β, Show α) ⇒ [Array β α] → String → String
-
Show_Array.showList
-
(Ix β, Show β, Show α) ⇒ Int → Array β α → String → String
-
Show_Array.showsPrec
-
STArray s i e → (i, i)
-
STArray.bounds
-
STArray s i e → Int
-
STArray.numElements
-
STArray α β γ → (Int→Int) → STArray α β γ
-
STArray.chg$cache
-
STArray α β γ → (β→β) → STArray α β γ
-
STArray.chg$lower
-
STArray α β γ → Int → STArray α β γ
-
STArray.upd$cache
-
STArray α β γ → β → STArray α β γ
-
STArray.upd$lower, STArray.upd$upper
-
STArray α β γ → ArrayOf α (AElem γ)
-
STArray.aelems
-
STArray α β γ → Int
-
STArray.cache
-
STArray α γ β → (γ→γ) → STArray α γ β
-
STArray.chg$upper
-
STArray β α γ → α
-
STArray.upper, STArray.lower
-
Array β α → (JArray (AElem α)→JArray (AElem γ)) → Array β γ
-
Array.chg$aelems
-
Array β α → JArray (AElem γ) → Array β γ
-
Array.upd$aelems
-
i → i → Int → ArrayOf s (AElem e) → STArray s i e
-
STArray.STArray
-
Ix i ⇒ (a → b → b) → b → Array i a → b
-
foldrElems, foldrElems'
-
Ix i ⇒ (a → b) → Array i a → Array i b
-
amap
-
Ix i ⇒ (b → a → b) → b → Array i a → b
-
foldlElems, foldlElems'
-
Ix i ⇒ (e → a → e) → Array i e → [(i, a)] → Array i e
-
accum
-
Ix i ⇒ (e → a → e) → e → (i, i) → [(i, a)] → Array i e
-
accumArray
-
Ix i ⇒ STArray s i e → i → e → ST s ()
-
STArray.write
-
Ix i ⇒ STArray s i e → i → ST s e
-
STArray.read
-
Ix i ⇒ STArray s i e → ST s (Array i e)
-
freezeSTArray
-
Ix i ⇒ Array i e → ST s (STArray s i e)
-
thawSTArray
-
Ix i ⇒ (i, i) → e → ST s (STArray s i e)
-
STArray.new
-
(Ix i, Ix j) ⇒ (i, i) → (i → j) → Array j e → Array i e
-
ixmap
-
Ix α ⇒ (β → γ) → Array α β → Array α γ
-
Functor_Array.fmap
-
STArray α δ β → (ArrayOf α (AElem β)→ArrayOf γ (AElem ε)) → STArray γ δ ε
-
STArray.chg$aelems
-
STArray α δ β → ArrayOf γ (AElem ε) → STArray γ δ ε
-
STArray.upd$aelems