Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Synopsis
- data DMap k f where
- empty :: DMap k f
- singleton :: k v -> f v -> DMap k f
- null :: DMap k f -> Bool
- size :: DMap k f -> Int
- lookup :: forall k f v. GCompare k => k v -> DMap k f -> Maybe (f v)
- lookupAssoc :: forall k f v. GCompare k => Some k -> DMap k f -> Maybe ( DSum k f)
- combine :: GCompare k => k v -> f v -> DMap k f -> DMap k f -> DMap k f
- insertMax :: k v -> f v -> DMap k f -> DMap k f
- insertMin :: k v -> f v -> DMap k f -> DMap k f
- merge :: DMap k f -> DMap k f -> DMap k f
- glue :: DMap k f -> DMap k f -> DMap k f
- deleteFindMin :: DMap k f -> ( DSum k f, DMap k f)
- data a :*: b = !a :*: !b
- toPair :: (a :*: b) -> (a, b)
- data Triple' a b c = Triple' !a !b !c
- toTriple :: Triple' a b c -> (a, b, c)
- minViewWithKey :: forall k f. DMap k f -> Maybe ( DSum k f, DMap k f)
- maxViewWithKey :: forall k f. DMap k f -> Maybe ( DSum k f, DMap k f)
- deleteFindMax :: DMap k f -> ( DSum k f, DMap k f)
- delta :: Int
- ratio :: Int
- balance :: k v -> f v -> DMap k f -> DMap k f -> DMap k f
- rotateL :: k v -> f v -> DMap k f -> DMap k f -> DMap k f
- rotateR :: k v -> f v -> DMap k f -> DMap k f -> DMap k f
- singleL :: k v -> f v -> DMap k f -> DMap k f -> DMap k f
- singleR :: k v -> f v -> DMap k f -> DMap k f -> DMap k f
- doubleL :: k v -> f v -> DMap k f -> DMap k f -> DMap k f
- doubleR :: k v -> f v -> DMap k f -> DMap k f -> DMap k f
- bin :: k v -> f v -> DMap k f -> DMap k f -> DMap k f
- trim :: ( Some k -> Ordering ) -> ( Some k -> Ordering ) -> DMap k f -> DMap k f
- trimLookupLo :: GCompare k => Some k -> ( Some k -> Ordering ) -> DMap k f -> ( Maybe ( DSum k f), DMap k f)
- filterGt :: GCompare k => ( Some k -> Ordering ) -> DMap k f -> DMap k f
- filterLt :: GCompare k => ( Some k -> Ordering ) -> DMap k f -> DMap k f
Documentation
Dependent maps:
k
is a GADT-like thing with a facility for
rediscovering its type parameter, elements of which function as identifiers
tagged with the type of the thing they identify. Real GADTs are one
useful instantiation of
k
, as are
Tag
s from
Data.Unique.Tag
in the
'prim-uniq' package.
Semantically,
is equivalent to a set of
DMap
k f
where no two
elements have the same tag.
DSum
k f
More informally,
DMap
is to dependent products as
Map
is to
(->)
.
Thus it could also be thought of as a partial (in the sense of "partial
function") dependent product.
Instances
( GEq k2, Has' Eq k2 f) => Eq ( DMap k2 f) Source # | |
( GCompare k2, Has' Eq k2 f, Has' Ord k2 f) => Ord ( DMap k2 f) Source # | |
Defined in Data.Dependent.Map |
|
( GCompare k2, GRead k2, Has' Read k2 f) => Read ( DMap k2 f) Source # | |
( GShow k2, Has' Show k2 f) => Show ( DMap k2 f) Source # | |
GCompare k2 => Semigroup ( DMap k2 f) Source # | |
GCompare k2 => Monoid ( DMap k2 f) Source # | |
singleton :: k v -> f v -> DMap k f Source #
O(1) . A map with a single element.
singleton 1 'a' == fromList [(1, 'a')] size (singleton 1 'a') == 1
deleteFindMin :: DMap k f -> ( DSum k f, DMap k f) Source #
O(log n) . Delete and find the minimal element.
deleteFindMin (fromList [(5,"a"), (3,"b"), (10,"c")]) == ((3,"b"), fromList[(5,"a"), (10,"c")]) deleteFindMin Error: can not return the minimal element of an empty map
minViewWithKey :: forall k f. DMap k f -> Maybe ( DSum k f, DMap k f) Source #
O(log n)
. Retrieves the minimal (key :=> value) entry of the map, and
the map stripped of that element, or
Nothing
if passed an empty map.
maxViewWithKey :: forall k f. DMap k f -> Maybe ( DSum k f, DMap k f) Source #
O(log n)
. Retrieves the maximal (key :=> value) entry of the map, and
the map stripped of that element, or
Nothing
if passed an empty map.
deleteFindMax :: DMap k f -> ( DSum k f, DMap k f) Source #
O(log n) . Delete and find the maximal element.
deleteFindMax (fromList [(5,"a"), (3,"b"), (10,"c")]) == ((10,"c"), fromList [(3,"b"), (5,"a")]) deleteFindMax empty Error: can not return the maximal element of an empty map