Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Language.Hasmtlib.Type.ArrayMap
Synopsis
- class ArrayMap f k v where
- asConst :: forall f k v. ArrayMap f k v => v -> f k v
- data ConstArray k v = ConstArray {}
- stored :: forall k v k. Lens (ConstArray k v) (ConstArray k v) (Map k v) (Map k v)
- arrConst :: forall k v. Lens' (ConstArray k v) v
Documentation
class ArrayMap f k v where Source #
Class that allows access to a map-like array where any value is either the default value or an overwritten values. Every index has a value by default. Values at indices can be overwritten manually.
Based on McCarthy`s basic array theory.
Therefore the following axioms must hold:
- forall A i x: arrSelect (store A i x) == x
- forall A i j x: i /= j ==> (arrSelect (arrStore A i x) j === arrSelect A j)
Methods
asConst' :: Proxy f -> Proxy k -> v -> f k v Source #
viewConst :: f k v -> v Source #
Instances
Ord k => ArrayMap ConstArray k v Source # | |
Defined in Language.Hasmtlib.Type.ArrayMap Methods asConst' :: Proxy ConstArray -> Proxy k -> v -> ConstArray k v Source # viewConst :: ConstArray k v -> v Source # arrSelect :: ConstArray k v -> k -> v Source # arrStore :: ConstArray k v -> k -> v -> ConstArray k v Source # |
data ConstArray k v Source #
A map-like array with a default constant value and partially overwritten values.
Constructors
ConstArray | |
Instances
stored :: forall k v k. Lens (ConstArray k v) (ConstArray k v) (Map k v) (Map k v) Source #
arrConst :: forall k v. Lens' (ConstArray k v) v Source #