Copyright | (c) 2018 Kowainik |
---|---|
License | MIT |
Maintainer | Kowainik <xrom.xkov@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
Relude.Extra.Map
Contents
Synopsis
- class StaticMap t where
- class StaticMap t => DynamicMap t where
- (!?) :: StaticMap t => t -> Key t -> Maybe (Val t)
- notMember :: StaticMap t => Key t -> t -> Bool
- lookupDefault :: StaticMap t => Val t -> Key t -> t -> Val t
- toPairs :: (IsList t, Item t ~ (a, b)) => t -> [(a, b)]
- keys :: (IsList t, Item t ~ (a, b)) => t -> [a]
- elems :: (IsList t, Item t ~ (a, b)) => t -> [b]
Documentation
class StaticMap t where Source #
Read-only map or set. Contains polymorphic functions which work for both sets and maps.
class StaticMap t => DynamicMap t where Source #
Modifiable Map.
Minimal complete definition
Methods
insert :: Key t -> Val t -> t -> t Source #
insertWith :: (Val t -> Val t -> Val t) -> Key t -> Val t -> t -> t Source #
delete :: Key t -> t -> t Source #
alter :: (Maybe (Val t) -> Maybe (Val t)) -> Key t -> t -> t Source #
Instances
(!?) :: StaticMap t => t -> Key t -> Maybe (Val t) infixl 9 Source #
Operator version of lookup
function.
Arguments
:: StaticMap t | |
=> Val t | Default value to return. |
-> Key t | Key to search |
-> t | Container to search |
-> Val t |
Return the value to which the specified key is mapped, or the default value if this map contains no mapping for the key.
To pairs
toPairs :: (IsList t, Item t ~ (a, b)) => t -> [(a, b)] Source #
Converts the structure to the list of the key-value pairs.
>>>
toPairs (HashMap.fromList [('a', "xxx"), ('b', "yyy")])
[('a',"xxx"),('b',"yyy")]