Copyright | (c) 2019 Edwin Westbrook |
---|---|
License | BSD3 |
Maintainer | westbrook@galois.com |
Stability | experimental |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- data NameMap (f :: k -> *)
- data NameAndElem f where
- NameAndElem :: Name a -> f a -> NameAndElem f
- empty :: NameMap f
- singleton :: Name a -> f a -> NameMap f
- fromList :: [NameAndElem f] -> NameMap f
- insert :: Name a -> f a -> NameMap f -> NameMap f
- delete :: Name a -> NameMap f -> NameMap f
- adjust :: (f a -> f a) -> Name a -> NameMap f -> NameMap f
- update :: (f a -> Maybe (f a)) -> Name a -> NameMap f -> NameMap f
- alter :: (Maybe (f a) -> Maybe (f a)) -> Name a -> NameMap f -> NameMap f
- lookup :: Name a -> NameMap f -> Maybe (f a)
- (!) :: NameMap f -> Name a -> f a
- member :: Name a -> NameMap f -> Bool
- null :: NameMap f -> Bool
- size :: NameMap f -> Int
- union :: NameMap f -> NameMap f -> NameMap f
- difference :: NameMap f -> NameMap f -> NameMap f
- (\\) :: NameMap f -> NameMap f -> NameMap f
- intersection :: NameMap f -> NameMap f -> NameMap f
- map :: (forall a. f a -> g a) -> NameMap f -> NameMap g
- foldr :: (forall a. f a -> b -> b) -> b -> NameMap f -> b
- foldl :: (forall b. a -> f b -> a) -> a -> NameMap f -> a
- assocs :: NameMap f -> [NameAndElem f]
- liftNameMap :: forall ctx f a. NuMatchingAny1 f => (forall a. Mb ctx (f a) -> Maybe (f a)) -> Mb ctx (NameMap f) -> NameMap f
Documentation
data NameMap (f :: k -> *) Source #
A heterogeneous map from Name
s of arbitrary type a
to elements of f a
data NameAndElem f where Source #
A pair of a Name
of some type a
along with an element of type f a
NameAndElem :: Name a -> f a -> NameAndElem f |
Instances
NuMatchingAny1 f => NuMatching (NameAndElem f) Source # | |
Defined in Data.Binding.Hobbits.NameMap nuMatchingProof :: MbTypeRepr (NameAndElem f) Source # |
fromList :: [NameAndElem f] -> NameMap f Source #
Build a NameMap
from a list of pairs of names and values they map to
adjust :: (f a -> f a) -> Name a -> NameMap f -> NameMap f Source #
Apply a function to the value mapped to by a Name
update :: (f a -> Maybe (f a)) -> Name a -> NameMap f -> NameMap f Source #
Update the value mapped to by a Name
, possibly deleting it
map :: (forall a. f a -> g a) -> NameMap f -> NameMap g Source #
Map a function across the values associated with each Name
foldr :: (forall a. f a -> b -> b) -> b -> NameMap f -> b Source #
Perform a right fold across all values in a NameMap
foldl :: (forall b. a -> f b -> a) -> a -> NameMap f -> a Source #
Perform a left fold across all values in a NameMap
assocs :: NameMap f -> [NameAndElem f] Source #
liftNameMap :: forall ctx f a. NuMatchingAny1 f => (forall a. Mb ctx (f a) -> Maybe (f a)) -> Mb ctx (NameMap f) -> NameMap f Source #
Lift a NameMap
out of a name-binding using a "partial lifting function"
that can lift some values in the NameMap
out of the binding. The resulting
NameMap
contains those names and associated values where the names were not
bound by the name-binding and the partial lifting function was able to lift
their associated values.