Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Dependent.EnumMap.Strict.Internal
Synopsis
- data KV (k :: kind -> Type) (v :: kind -> Type) = KV !(Enum1Info k) !(v a)
- newtype DEnumMap (k :: kind -> Type) (v :: kind -> Type) = DEnumMap (IntMap (KV k v))
- class Enum1 (f :: k -> Type) where
- dSumToKV :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). Enum1 k => DSum k v -> (Int, KV k v)
- kVToDSum :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). Enum1 k2 => (Int, KV k2 v) -> DSum k2 v
- empty :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). DEnumMap k v
- singleton :: forall {kind} k (a :: kind) v. Enum1 k => k a -> v a -> DEnumMap k v
- fromList :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). Enum1 k => [DSum k v] -> DEnumMap k v
- fromListWith :: forall {kind} (k :: kind -> Type) v. (Enum1 k, TestEquality k) => (forall (a :: kind). v a -> v a -> v a) -> [DSum k v] -> DEnumMap k v
- fromListWithKey :: (Enum1 k, TestEquality k) => (forall (a :: kind). k a -> v a -> v a -> v a) -> [DSum k v] -> DEnumMap k v
- fromAscList :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). Enum1 k => [DSum k v] -> DEnumMap k v
- fromAscListWith :: forall {kind} (k :: kind -> Type) v. (Enum1 k, TestEquality k) => (forall (a :: kind). v a -> v a -> v a) -> [DSum k v] -> DEnumMap k v
- fromAscListWithKey :: (Enum1 k, TestEquality k) => (forall (a :: kind). k a -> v a -> v a -> v a) -> [DSum k v] -> DEnumMap k v
- fromDistinctAscList :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). Enum1 k => [DSum k v] -> DEnumMap k v
- insert :: forall {kind} k (a :: kind) v. Enum1 k => k a -> v a -> DEnumMap k v -> DEnumMap k v
- insertWith :: forall {kind} k v (a :: kind). (Enum1 k, TestEquality k) => (v a -> v a -> v a) -> k a -> v a -> DEnumMap k v -> DEnumMap k v
- insertWithKey :: forall {kind} k (a :: kind) v. (Enum1 k, TestEquality k) => (k a -> v a -> v a -> v a) -> k a -> v a -> DEnumMap k v -> DEnumMap k v
- insertLookupWithKey :: forall {kind} k (a :: kind) v. (Enum1 k, TestEquality k) => (k a -> v a -> v a -> v a) -> k a -> v a -> DEnumMap k v -> (Maybe (v a), DEnumMap k v)
- delete :: forall {kind} k (a :: kind) (v :: kind -> Type). Enum1 k => k a -> DEnumMap k v -> DEnumMap k v
- adjust :: forall {kind} k v (a :: kind). (Enum1 k, TestEquality k) => (v a -> v a) -> k a -> DEnumMap k v -> DEnumMap k v
- adjustWithKey :: forall {kind} k (a :: kind) v. (Enum1 k, TestEquality k) => (k a -> v a -> v a) -> k a -> DEnumMap k v -> DEnumMap k v
- update :: forall {kind} k v (a :: kind). (Enum1 k, TestEquality k) => (v a -> Maybe (v a)) -> k a -> DEnumMap k v -> DEnumMap k v
- updateWithKey :: forall {kind} k (a :: kind) v. (Enum1 k, TestEquality k) => (k a -> v a -> Maybe (v a)) -> k a -> DEnumMap k v -> DEnumMap k v
- updateLookupWithKey :: forall {kind} k (a :: kind) v. (Enum1 k, TestEquality k) => (k a -> v a -> Maybe (v a)) -> k a -> DEnumMap k v -> (Maybe (v a), DEnumMap k v)
- alter :: forall {kind} k v (a :: kind). (Enum1 k, TestEquality k) => (Maybe (v a) -> Maybe (v a)) -> k a -> DEnumMap k v -> DEnumMap k v
- alterF :: forall {kind} k v (a :: kind) f. (Functor f, Enum1 k, TestEquality k) => (Maybe (v a) -> f (Maybe (v a))) -> k a -> DEnumMap k v -> f (DEnumMap k v)
- lookup :: forall {kind} k (a :: kind) v. (Enum1 k, TestEquality k) => k a -> DEnumMap k v -> Maybe (v a)
- (!?) :: forall {kind} k v (a :: kind). (Enum1 k, TestEquality k) => DEnumMap k v -> k a -> Maybe (v a)
- findWithDefault :: forall {kind} k v (a :: kind). (Enum1 k, TestEquality k) => v a -> k a -> DEnumMap k v -> v a
- find :: forall {kind} k (a :: kind) v. (Enum1 k, TestEquality k) => k a -> DEnumMap k v -> v a
- (!) :: forall {kind} k v (a :: kind). (Enum1 k, TestEquality k) => DEnumMap k v -> k a -> v a
- member :: forall {kind} k (a :: kind) (v :: kind -> Type). Enum1 k => k a -> DEnumMap k v -> Bool
- notMember :: forall {kind} k (a :: kind) (v :: kind -> Type). Enum1 k => k a -> DEnumMap k v -> Bool
- lookupLT :: forall {k1} k2 (a :: k1) (v :: k1 -> Type). Enum1 k2 => k2 a -> DEnumMap k2 v -> Maybe (DSum k2 v)
- lookupGT :: forall {k1} k2 (a :: k1) (v :: k1 -> Type). Enum1 k2 => k2 a -> DEnumMap k2 v -> Maybe (DSum k2 v)
- lookupLE :: forall {k1} k2 (a :: k1) (v :: k1 -> Type). Enum1 k2 => k2 a -> DEnumMap k2 v -> Maybe (DSum k2 v)
- lookupGE :: forall {k1} k2 (a :: k1) (v :: k1 -> Type). Enum1 k2 => k2 a -> DEnumMap k2 v -> Maybe (DSum k2 v)
- null :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). DEnumMap k v -> Bool
- size :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). DEnumMap k v -> Int
- union :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). (Enum1 k, TestEquality k) => DEnumMap k v -> DEnumMap k v -> DEnumMap k v
- unionWith :: forall {kind} (k :: kind -> Type) v. (Enum1 k, TestEquality k) => (forall (a :: kind). v a -> v a -> v a) -> DEnumMap k v -> DEnumMap k v -> DEnumMap k v
- unionWithKey :: (Enum1 k, TestEquality k) => (forall (a :: kind). k a -> v a -> v a -> v a) -> DEnumMap k v -> DEnumMap k v -> DEnumMap k v
- unions :: forall {kind} f (k :: kind -> Type) (v :: kind -> Type). (Foldable f, Enum1 k, TestEquality k) => f (DEnumMap k v) -> DEnumMap k v
- unionsWith :: forall {kind} f (k :: kind -> Type) v. (Foldable f, Enum1 k, TestEquality k) => (forall (a :: kind). v a -> v a -> v a) -> f (DEnumMap k v) -> DEnumMap k v
- difference :: forall {kind} (k :: kind -> Type) (v1 :: kind -> Type) (v2 :: kind -> Type). DEnumMap k v1 -> DEnumMap k v2 -> DEnumMap k v1
- (\\) :: forall {kind} (k :: kind -> Type) (v1 :: kind -> Type) (v2 :: kind -> Type). DEnumMap k v1 -> DEnumMap k v2 -> DEnumMap k v1
- differenceWith :: forall {kind} (k :: kind -> Type) v1 v2. (Enum1 k, TestEquality k) => (forall (a :: kind). v1 a -> v2 a -> Maybe (v1 a)) -> DEnumMap k v1 -> DEnumMap k v2 -> DEnumMap k v1
- differenceWithKey :: (Enum1 k, TestEquality k) => (forall (a :: kind). k a -> v1 a -> v2 a -> Maybe (v1 a)) -> DEnumMap k v1 -> DEnumMap k v2 -> DEnumMap k v1
- differenceWithKey' :: forall {kind1} {kind2} k1 k2 v1 v2. (Enum1 k1, Enum1 k2) => (forall (a :: kind1) (b :: kind2). k1 a -> v1 a -> k2 b -> v2 b -> Maybe (v1 a)) -> DEnumMap k1 v1 -> DEnumMap k2 v2 -> DEnumMap k1 v1
- intersection :: forall {kind} (k :: kind -> Type) (v1 :: kind -> Type) (v2 :: kind -> Type). DEnumMap k v1 -> DEnumMap k v2 -> DEnumMap k v1
- intersectionWith :: forall {kind} (k :: kind -> Type) v1 v2 v3. (Enum1 k, TestEquality k) => (forall (a :: kind). v1 a -> v2 a -> v3 a) -> DEnumMap k v1 -> DEnumMap k v2 -> DEnumMap k v3
- intersectionWithKey :: (Enum1 k, TestEquality k) => (forall (a :: kind). k a -> v1 a -> v2 a -> v3 a) -> DEnumMap k v1 -> DEnumMap k v2 -> DEnumMap k v3
- intersectionWithKey' :: forall {kind1} {kind2} k1 k2 v1 v2 v3. (Enum1 k1, Enum1 k2) => (forall (a :: kind1) (b :: kind2). k1 a -> v1 a -> k2 b -> v2 b -> v3 a) -> DEnumMap k1 v1 -> DEnumMap k2 v2 -> DEnumMap k1 v3
- disjoint :: forall {kind} (k :: kind -> Type) (v1 :: kind -> Type) (v2 :: kind -> Type). DEnumMap k v1 -> DEnumMap k v2 -> Bool
- compose :: forall {kind} (k2 :: kind -> Type) (v :: kind -> Type) (k1 :: kind -> Type). (Enum1 k2, TestEquality k2) => DEnumMap k2 v -> DEnumMap k1 k2 -> DEnumMap k1 v
- mergeWithKey :: (Enum1 k, TestEquality k) => (forall (a :: kind). k a -> v1 a -> v2 a -> Maybe (v3 a)) -> (DEnumMap k v1 -> DEnumMap k v3) -> (DEnumMap k v2 -> DEnumMap k v3) -> DEnumMap k v1 -> DEnumMap k v2 -> DEnumMap k v3
- map :: forall {kind} (k :: kind -> Type) v1 v2. Enum1 k => (forall (a :: kind). v1 a -> v2 a) -> DEnumMap k v1 -> DEnumMap k v2
- mapWithKey :: Enum1 k => (forall (a :: kind). k a -> v1 a -> v2 a) -> DEnumMap k v1 -> DEnumMap k v2
- traverseWithKey :: forall {kind} f k v1 v2. (Applicative f, Enum1 k) => (forall (a :: kind). k a -> v1 a -> f (v2 a)) -> DEnumMap k v1 -> f (DEnumMap k v2)
- traverseMaybeWithKey :: forall {kind} f k v1 v2. (Applicative f, Enum1 k) => (forall (a :: kind). k a -> v1 a -> f (Maybe (v2 a))) -> DEnumMap k v1 -> f (DEnumMap k v2)
- mapAccum :: forall {kind} (k :: kind -> Type) acc v1 v2. Enum1 k => (forall (a :: kind). acc -> v1 a -> (acc, v2 a)) -> acc -> DEnumMap k v1 -> (acc, DEnumMap k v2)
- mapAccumWithKey :: Enum1 k => (forall (a :: kind). acc -> k a -> v1 a -> (acc, v2 a)) -> acc -> DEnumMap k v1 -> (acc, DEnumMap k v2)
- mapAccumRWithKey :: Enum1 k => (forall (a :: kind). acc -> k a -> v1 a -> (acc, v2 a)) -> acc -> DEnumMap k v1 -> (acc, DEnumMap k v2)
- foldr :: forall {kind} v acc (k :: kind -> Type). (forall (a :: kind). v a -> acc -> acc) -> acc -> DEnumMap k v -> acc
- foldl :: forall {kind} acc v (k :: kind -> Type). (forall (a :: kind). acc -> v a -> acc) -> acc -> DEnumMap k v -> acc
- foldrWithKey :: Enum1 k => (forall (a :: kind). k a -> v a -> acc -> acc) -> acc -> DEnumMap k v -> acc
- foldlWithKey :: Enum1 k => (forall (a :: kind). acc -> k a -> v a -> acc) -> acc -> DEnumMap k v -> acc
- foldMapWithKey :: forall {kind} m k v. (Monoid m, Enum1 k) => (forall (a :: kind). k a -> v a -> m) -> DEnumMap k v -> m
- foldr' :: forall {kind} v acc (k :: kind -> Type). (forall (a :: kind). v a -> acc -> acc) -> acc -> DEnumMap k v -> acc
- foldl' :: forall {kind} acc v (k :: kind -> Type). (forall (a :: kind). acc -> v a -> acc) -> acc -> DEnumMap k v -> acc
- foldrWithKey' :: Enum1 k => (forall (a :: kind). k a -> v a -> acc -> acc) -> acc -> DEnumMap k v -> acc
- foldlWithKey' :: Enum1 k => (forall (a :: kind). acc -> k a -> v a -> acc) -> acc -> DEnumMap k v -> acc
- elems :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). DEnumMap k2 v -> [Some v]
- keys :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). Enum1 k2 => DEnumMap k2 v -> [Some k2]
- assocs :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). Enum1 k2 => DEnumMap k2 v -> [DSum k2 v]
- toList :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). Enum1 k2 => DEnumMap k2 v -> [DSum k2 v]
- toAscList :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). Enum1 k2 => DEnumMap k2 v -> [DSum k2 v]
- toDescList :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). Enum1 k2 => DEnumMap k2 v -> [DSum k2 v]
- filter :: forall {kind} v (k :: kind -> Type). (forall (a :: kind). v a -> Bool) -> DEnumMap k v -> DEnumMap k v
- filterWithKey :: Enum1 k => (forall (a :: kind). k a -> v a -> Bool) -> DEnumMap k v -> DEnumMap k v
- partition :: forall {kind} v (k :: kind -> Type). (forall (a :: kind). v a -> Bool) -> DEnumMap k v -> (DEnumMap k v, DEnumMap k v)
- partitionWithKey :: Enum1 k => (forall (a :: kind). k a -> v a -> Bool) -> DEnumMap k v -> (DEnumMap k v, DEnumMap k v)
- takeWhileAntitone :: forall {kind} k (v :: kind -> Type). Enum1 k => (forall (a :: kind). k a -> Bool) -> DEnumMap k v -> DEnumMap k v
- dropWhileAntitone :: forall {kind} k (v :: kind -> Type). Enum1 k => (forall (a :: kind). k a -> Bool) -> DEnumMap k v -> DEnumMap k v
- spanAntitone :: forall {kind} k (v :: kind -> Type). Enum1 k => (forall (a :: kind). k a -> Bool) -> DEnumMap k v -> (DEnumMap k v, DEnumMap k v)
- mapMaybe :: forall {kind} (k :: kind -> Type) v1 v2. Enum1 k => (forall (a :: kind). v1 a -> Maybe (v2 a)) -> DEnumMap k v1 -> DEnumMap k v2
- mapMaybeWithKey :: Enum1 k => (forall (a :: kind). k a -> v1 a -> Maybe (v2 a)) -> DEnumMap k v1 -> DEnumMap k v2
- mapEither :: forall {kind} (k :: kind -> Type) v1 v2 v3. Enum1 k => (forall (a :: kind). v1 a -> Either (v2 a) (v3 a)) -> DEnumMap k v1 -> (DEnumMap k v2, DEnumMap k v3)
- mapEitherWithKey :: Enum1 k => (forall (a :: kind). k a -> v1 a -> Either (v2 a) (v3 a)) -> DEnumMap k v1 -> (DEnumMap k v2, DEnumMap k v3)
- split :: forall {kind} k (a :: kind) (v :: kind -> Type). Enum1 k => k a -> DEnumMap k v -> (DEnumMap k v, DEnumMap k v)
- splitLookup :: forall {kind} k (a :: kind) v. Enum1 k => k a -> DEnumMap k v -> (DEnumMap k v, Maybe (v a), DEnumMap k v)
- splitRoot :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). DEnumMap k v -> [DEnumMap k v]
- isSubmapOf :: forall {kind} (v :: kind -> Type) (k :: kind -> Type). (forall (a :: kind). Eq (v a)) => DEnumMap k v -> DEnumMap k v -> Bool
- isSubmapOfBy :: forall {kind} v1 v2 (k :: kind -> Type). (forall (a :: kind). v1 a -> v2 a -> Bool) -> DEnumMap k v1 -> DEnumMap k v2 -> Bool
- isProperSubmapOf :: forall {kind} (v :: kind -> Type) (k :: kind -> Type). (forall (a :: kind). Eq (v a)) => DEnumMap k v -> DEnumMap k v -> Bool
- isProperSubmapOfBy :: forall {kind} v1 v2 (k :: kind -> Type). (forall (a :: kind). v1 a -> v2 a -> Bool) -> DEnumMap k v1 -> DEnumMap k v2 -> Bool
- lookupMin :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). Enum1 k2 => DEnumMap k2 v -> Maybe (DSum k2 v)
- lookupMax :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). Enum1 k2 => DEnumMap k2 v -> Maybe (DSum k2 v)
- findMin :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). Enum1 k2 => DEnumMap k2 v -> DSum k2 v
- findMax :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). Enum1 k2 => DEnumMap k2 v -> DSum k2 v
- deleteMin :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). DEnumMap k v -> DEnumMap k v
- deleteMax :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). DEnumMap k v -> DEnumMap k v
- deleteFindMin :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). Enum1 k => DEnumMap k v -> (DSum k v, DEnumMap k v)
- deleteFindMax :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). Enum1 k => DEnumMap k v -> (DSum k v, DEnumMap k v)
- updateMin :: forall {kind} (k :: kind -> Type) v. Enum1 k => (forall (a :: kind). v a -> Maybe (v a)) -> DEnumMap k v -> DEnumMap k v
- updateMinWithKey :: Enum1 k => (forall (a :: kind). k a -> v a -> Maybe (v a)) -> DEnumMap k v -> DEnumMap k v
- updateMax :: forall {kind} (k :: kind -> Type) v. Enum1 k => (forall (a :: kind). v a -> Maybe (v a)) -> DEnumMap k v -> DEnumMap k v
- updateMaxWithKey :: Enum1 k => (forall (a :: kind). k a -> v a -> Maybe (v a)) -> DEnumMap k v -> DEnumMap k v
- minView :: forall {kind} (k :: kind -> Type) v (a :: kind). DEnumMap k v -> Maybe (v a, DEnumMap k v)
- maxView :: forall {kind} (k :: kind -> Type) v (a :: kind). DEnumMap k v -> Maybe (v a, DEnumMap k v)
- minViewWithKey :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). Enum1 k => DEnumMap k v -> Maybe (DSum k v, DEnumMap k v)
- maxViewWithKey :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). Enum1 k => DEnumMap k v -> Maybe (DSum k v, DEnumMap k v)
- coe1 :: forall {k} v (a :: k) (b :: k). v a -> v b
- typeCheck1 :: forall {k1} k2 (a :: k1) r. (Enum1 k2, TestEquality k2) => k2 a -> Int -> Enum1Info k2 -> r -> r
- typeCheck2 :: forall {k1} (k2 :: k1 -> Type) proxy r. (Enum1 k2, TestEquality k2) => proxy k2 -> Int -> Enum1Info k2 -> Enum1Info k2 -> r -> r
Documentation
class Enum1 (f :: k -> Type) where Source #
This class attempts to generalise Enum
to indexed data types: data types
with a GADT-like type parameter. Conversion to an Int
naturally loses type
information, and furthermore it is common to actually need some additional
data alongside the Int
to be able to reconstruct the original (in
toEnum1
). This additional data lives in Enum1Info
. The laws are:
- Unique IDs
- If
thenfst
(fromEnum1
x) ==fst
(fromEnum1
y)testEquality
x y ==Just
Refl
&& x==
y - Persistent IDs
fst
(fromEnum1
(uncurry
toEnum1
(fromEnum1
x))) ==fst
(fromEnum1
x)
The "Unique IDs" law states that if the IDs of two values are equal, then
the values themselves must have the same type index, and furthermore be
equal. If f
does not implement TestEquality
or Eq
, the law should
morally hold (but most of the API will be unusable).
The "Persistent IDs" law states that reconstructing a value using toEnum1
does not change its ID.
Note: The methods on DEnumMap
attempt to check these laws using
assert
assertions (which are by default disabled when optimisations
are on!), but full consistency cannot always be checked; if you break these
laws in a sufficiently clever way, the internals of DEnumMap
may
unsafeCoerce
unequal things and engage nasal demons, including crashes and
worse.
dSumToKV :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). Enum1 k => DSum k v -> (Int, KV k v) Source #
kVToDSum :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). Enum1 k2 => (Int, KV k2 v) -> DSum k2 v Source #
Assumes that the input was obtained via fromEnum1
.
Construction
From Unordered Lists
fromList :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). Enum1 k => [DSum k v] -> DEnumMap k v Source #
fromListWith :: forall {kind} (k :: kind -> Type) v. (Enum1 k, TestEquality k) => (forall (a :: kind). v a -> v a -> v a) -> [DSum k v] -> DEnumMap k v Source #
fromListWithKey :: (Enum1 k, TestEquality k) => (forall (a :: kind). k a -> v a -> v a -> v a) -> [DSum k v] -> DEnumMap k v Source #
From Ascending Lists
fromAscList :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). Enum1 k => [DSum k v] -> DEnumMap k v Source #
fromAscListWith :: forall {kind} (k :: kind -> Type) v. (Enum1 k, TestEquality k) => (forall (a :: kind). v a -> v a -> v a) -> [DSum k v] -> DEnumMap k v Source #
fromAscListWithKey :: (Enum1 k, TestEquality k) => (forall (a :: kind). k a -> v a -> v a -> v a) -> [DSum k v] -> DEnumMap k v Source #
fromDistinctAscList :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). Enum1 k => [DSum k v] -> DEnumMap k v Source #
Insertion
insert :: forall {kind} k (a :: kind) v. Enum1 k => k a -> v a -> DEnumMap k v -> DEnumMap k v Source #
insertWith :: forall {kind} k v (a :: kind). (Enum1 k, TestEquality k) => (v a -> v a -> v a) -> k a -> v a -> DEnumMap k v -> DEnumMap k v Source #
insertWithKey :: forall {kind} k (a :: kind) v. (Enum1 k, TestEquality k) => (k a -> v a -> v a -> v a) -> k a -> v a -> DEnumMap k v -> DEnumMap k v Source #
insertLookupWithKey :: forall {kind} k (a :: kind) v. (Enum1 k, TestEquality k) => (k a -> v a -> v a -> v a) -> k a -> v a -> DEnumMap k v -> (Maybe (v a), DEnumMap k v) Source #
Deletion/Update
delete :: forall {kind} k (a :: kind) (v :: kind -> Type). Enum1 k => k a -> DEnumMap k v -> DEnumMap k v Source #
adjust :: forall {kind} k v (a :: kind). (Enum1 k, TestEquality k) => (v a -> v a) -> k a -> DEnumMap k v -> DEnumMap k v Source #
adjustWithKey :: forall {kind} k (a :: kind) v. (Enum1 k, TestEquality k) => (k a -> v a -> v a) -> k a -> DEnumMap k v -> DEnumMap k v Source #
update :: forall {kind} k v (a :: kind). (Enum1 k, TestEquality k) => (v a -> Maybe (v a)) -> k a -> DEnumMap k v -> DEnumMap k v Source #
updateWithKey :: forall {kind} k (a :: kind) v. (Enum1 k, TestEquality k) => (k a -> v a -> Maybe (v a)) -> k a -> DEnumMap k v -> DEnumMap k v Source #
updateLookupWithKey :: forall {kind} k (a :: kind) v. (Enum1 k, TestEquality k) => (k a -> v a -> Maybe (v a)) -> k a -> DEnumMap k v -> (Maybe (v a), DEnumMap k v) Source #
alter :: forall {kind} k v (a :: kind). (Enum1 k, TestEquality k) => (Maybe (v a) -> Maybe (v a)) -> k a -> DEnumMap k v -> DEnumMap k v Source #
alterF :: forall {kind} k v (a :: kind) f. (Functor f, Enum1 k, TestEquality k) => (Maybe (v a) -> f (Maybe (v a))) -> k a -> DEnumMap k v -> f (DEnumMap k v) Source #
Query
Lookup
lookup :: forall {kind} k (a :: kind) v. (Enum1 k, TestEquality k) => k a -> DEnumMap k v -> Maybe (v a) Source #
(!?) :: forall {kind} k v (a :: kind). (Enum1 k, TestEquality k) => DEnumMap k v -> k a -> Maybe (v a) Source #
findWithDefault :: forall {kind} k v (a :: kind). (Enum1 k, TestEquality k) => v a -> k a -> DEnumMap k v -> v a Source #
find :: forall {kind} k (a :: kind) v. (Enum1 k, TestEquality k) => k a -> DEnumMap k v -> v a Source #
(!) :: forall {kind} k v (a :: kind). (Enum1 k, TestEquality k) => DEnumMap k v -> k a -> v a Source #
member :: forall {kind} k (a :: kind) (v :: kind -> Type). Enum1 k => k a -> DEnumMap k v -> Bool Source #
notMember :: forall {kind} k (a :: kind) (v :: kind -> Type). Enum1 k => k a -> DEnumMap k v -> Bool Source #
lookupLT :: forall {k1} k2 (a :: k1) (v :: k1 -> Type). Enum1 k2 => k2 a -> DEnumMap k2 v -> Maybe (DSum k2 v) Source #
lookupGT :: forall {k1} k2 (a :: k1) (v :: k1 -> Type). Enum1 k2 => k2 a -> DEnumMap k2 v -> Maybe (DSum k2 v) Source #
lookupLE :: forall {k1} k2 (a :: k1) (v :: k1 -> Type). Enum1 k2 => k2 a -> DEnumMap k2 v -> Maybe (DSum k2 v) Source #
lookupGE :: forall {k1} k2 (a :: k1) (v :: k1 -> Type). Enum1 k2 => k2 a -> DEnumMap k2 v -> Maybe (DSum k2 v) Source #
Size
Combine
Union
union :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). (Enum1 k, TestEquality k) => DEnumMap k v -> DEnumMap k v -> DEnumMap k v Source #
unionWith :: forall {kind} (k :: kind -> Type) v. (Enum1 k, TestEquality k) => (forall (a :: kind). v a -> v a -> v a) -> DEnumMap k v -> DEnumMap k v -> DEnumMap k v Source #
unionWithKey :: (Enum1 k, TestEquality k) => (forall (a :: kind). k a -> v a -> v a -> v a) -> DEnumMap k v -> DEnumMap k v -> DEnumMap k v Source #
unions :: forall {kind} f (k :: kind -> Type) (v :: kind -> Type). (Foldable f, Enum1 k, TestEquality k) => f (DEnumMap k v) -> DEnumMap k v Source #
unionsWith :: forall {kind} f (k :: kind -> Type) v. (Foldable f, Enum1 k, TestEquality k) => (forall (a :: kind). v a -> v a -> v a) -> f (DEnumMap k v) -> DEnumMap k v Source #
Difference
difference :: forall {kind} (k :: kind -> Type) (v1 :: kind -> Type) (v2 :: kind -> Type). DEnumMap k v1 -> DEnumMap k v2 -> DEnumMap k v1 Source #
(\\) :: forall {kind} (k :: kind -> Type) (v1 :: kind -> Type) (v2 :: kind -> Type). DEnumMap k v1 -> DEnumMap k v2 -> DEnumMap k v1 Source #
differenceWith :: forall {kind} (k :: kind -> Type) v1 v2. (Enum1 k, TestEquality k) => (forall (a :: kind). v1 a -> v2 a -> Maybe (v1 a)) -> DEnumMap k v1 -> DEnumMap k v2 -> DEnumMap k v1 Source #
differenceWithKey :: (Enum1 k, TestEquality k) => (forall (a :: kind). k a -> v1 a -> v2 a -> Maybe (v1 a)) -> DEnumMap k v1 -> DEnumMap k v2 -> DEnumMap k v1 Source #
differenceWithKey' :: forall {kind1} {kind2} k1 k2 v1 v2. (Enum1 k1, Enum1 k2) => (forall (a :: kind1) (b :: kind2). k1 a -> v1 a -> k2 b -> v2 b -> Maybe (v1 a)) -> DEnumMap k1 v1 -> DEnumMap k2 v2 -> DEnumMap k1 v1 Source #
Because the underlying maps are keyed on integers, it is possible to
subtract a map from another even if the key types differ. This function
assumes that the Int
identifiers of k1
and k2
are compatible, i.e.
that "2" in k1
somehow means the same thing as "2" in k2
.
Because the key types are different, there is no guarantee whatsoever (even
not by Enum1
laws) that equal key IDs in k1
and k2
actually have the
same type index (a
). Hence, the combining function gets key-value pairs
with potentially distinct type indices.
Intersection
intersection :: forall {kind} (k :: kind -> Type) (v1 :: kind -> Type) (v2 :: kind -> Type). DEnumMap k v1 -> DEnumMap k v2 -> DEnumMap k v1 Source #
intersectionWith :: forall {kind} (k :: kind -> Type) v1 v2 v3. (Enum1 k, TestEquality k) => (forall (a :: kind). v1 a -> v2 a -> v3 a) -> DEnumMap k v1 -> DEnumMap k v2 -> DEnumMap k v3 Source #
intersectionWithKey :: (Enum1 k, TestEquality k) => (forall (a :: kind). k a -> v1 a -> v2 a -> v3 a) -> DEnumMap k v1 -> DEnumMap k v2 -> DEnumMap k v3 Source #
intersectionWithKey' :: forall {kind1} {kind2} k1 k2 v1 v2 v3. (Enum1 k1, Enum1 k2) => (forall (a :: kind1) (b :: kind2). k1 a -> v1 a -> k2 b -> v2 b -> v3 a) -> DEnumMap k1 v1 -> DEnumMap k2 v2 -> DEnumMap k1 v3 Source #
Generalises intersectionWithKey
in the same way as differenceWithKey'
generalises differenceWithKey
.
Disjoint
disjoint :: forall {kind} (k :: kind -> Type) (v1 :: kind -> Type) (v2 :: kind -> Type). DEnumMap k v1 -> DEnumMap k v2 -> Bool Source #
Compose
compose :: forall {kind} (k2 :: kind -> Type) (v :: kind -> Type) (k1 :: kind -> Type). (Enum1 k2, TestEquality k2) => DEnumMap k2 v -> DEnumMap k1 k2 -> DEnumMap k1 v Source #
Universal combining function
mergeWithKey :: (Enum1 k, TestEquality k) => (forall (a :: kind). k a -> v1 a -> v2 a -> Maybe (v3 a)) -> (DEnumMap k v1 -> DEnumMap k v3) -> (DEnumMap k v2 -> DEnumMap k v3) -> DEnumMap k v1 -> DEnumMap k v2 -> DEnumMap k v3 Source #
Traversal
Map
map :: forall {kind} (k :: kind -> Type) v1 v2. Enum1 k => (forall (a :: kind). v1 a -> v2 a) -> DEnumMap k v1 -> DEnumMap k v2 Source #
mapWithKey :: Enum1 k => (forall (a :: kind). k a -> v1 a -> v2 a) -> DEnumMap k v1 -> DEnumMap k v2 Source #
traverseWithKey :: forall {kind} f k v1 v2. (Applicative f, Enum1 k) => (forall (a :: kind). k a -> v1 a -> f (v2 a)) -> DEnumMap k v1 -> f (DEnumMap k v2) Source #
traverseMaybeWithKey :: forall {kind} f k v1 v2. (Applicative f, Enum1 k) => (forall (a :: kind). k a -> v1 a -> f (Maybe (v2 a))) -> DEnumMap k v1 -> f (DEnumMap k v2) Source #
mapAccum :: forall {kind} (k :: kind -> Type) acc v1 v2. Enum1 k => (forall (a :: kind). acc -> v1 a -> (acc, v2 a)) -> acc -> DEnumMap k v1 -> (acc, DEnumMap k v2) Source #
mapAccumWithKey :: Enum1 k => (forall (a :: kind). acc -> k a -> v1 a -> (acc, v2 a)) -> acc -> DEnumMap k v1 -> (acc, DEnumMap k v2) Source #
mapAccumRWithKey :: Enum1 k => (forall (a :: kind). acc -> k a -> v1 a -> (acc, v2 a)) -> acc -> DEnumMap k v1 -> (acc, DEnumMap k v2) Source #
Folds
foldr :: forall {kind} v acc (k :: kind -> Type). (forall (a :: kind). v a -> acc -> acc) -> acc -> DEnumMap k v -> acc Source #
foldl :: forall {kind} acc v (k :: kind -> Type). (forall (a :: kind). acc -> v a -> acc) -> acc -> DEnumMap k v -> acc Source #
foldrWithKey :: Enum1 k => (forall (a :: kind). k a -> v a -> acc -> acc) -> acc -> DEnumMap k v -> acc Source #
foldlWithKey :: Enum1 k => (forall (a :: kind). acc -> k a -> v a -> acc) -> acc -> DEnumMap k v -> acc Source #
foldMapWithKey :: forall {kind} m k v. (Monoid m, Enum1 k) => (forall (a :: kind). k a -> v a -> m) -> DEnumMap k v -> m Source #
Strict folds
foldr' :: forall {kind} v acc (k :: kind -> Type). (forall (a :: kind). v a -> acc -> acc) -> acc -> DEnumMap k v -> acc Source #
foldl' :: forall {kind} acc v (k :: kind -> Type). (forall (a :: kind). acc -> v a -> acc) -> acc -> DEnumMap k v -> acc Source #
foldrWithKey' :: Enum1 k => (forall (a :: kind). k a -> v a -> acc -> acc) -> acc -> DEnumMap k v -> acc Source #
foldlWithKey' :: Enum1 k => (forall (a :: kind). acc -> k a -> v a -> acc) -> acc -> DEnumMap k v -> acc Source #
Conversion
keys :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). Enum1 k2 => DEnumMap k2 v -> [Some k2] Source #
assocs :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). Enum1 k2 => DEnumMap k2 v -> [DSum k2 v] Source #
Lists
toList :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). Enum1 k2 => DEnumMap k2 v -> [DSum k2 v] Source #
Ordered lists
toAscList :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). Enum1 k2 => DEnumMap k2 v -> [DSum k2 v] Source #
toDescList :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). Enum1 k2 => DEnumMap k2 v -> [DSum k2 v] Source #
Filter
filter :: forall {kind} v (k :: kind -> Type). (forall (a :: kind). v a -> Bool) -> DEnumMap k v -> DEnumMap k v Source #
filterWithKey :: Enum1 k => (forall (a :: kind). k a -> v a -> Bool) -> DEnumMap k v -> DEnumMap k v Source #
partition :: forall {kind} v (k :: kind -> Type). (forall (a :: kind). v a -> Bool) -> DEnumMap k v -> (DEnumMap k v, DEnumMap k v) Source #
partitionWithKey :: Enum1 k => (forall (a :: kind). k a -> v a -> Bool) -> DEnumMap k v -> (DEnumMap k v, DEnumMap k v) Source #
takeWhileAntitone :: forall {kind} k (v :: kind -> Type). Enum1 k => (forall (a :: kind). k a -> Bool) -> DEnumMap k v -> DEnumMap k v Source #
\(O(\min(n,W)^2)\). Because of the lack of a takeWhileAntitoneWithValue
operation on IntMap
, this function performs additional lookups to
reconstruct the full keys to pass to the predicate, resulting in a somewhat
worse complexity than takeWhileAntitone
.
dropWhileAntitone :: forall {kind} k (v :: kind -> Type). Enum1 k => (forall (a :: kind). k a -> Bool) -> DEnumMap k v -> DEnumMap k v Source #
\(O(\min(n,W)^2)\). See takeWhileAntitone
.
spanAntitone :: forall {kind} k (v :: kind -> Type). Enum1 k => (forall (a :: kind). k a -> Bool) -> DEnumMap k v -> (DEnumMap k v, DEnumMap k v) Source #
\(O(\min(n,W)^2)\). See takeWhileAntitone
.
mapMaybe :: forall {kind} (k :: kind -> Type) v1 v2. Enum1 k => (forall (a :: kind). v1 a -> Maybe (v2 a)) -> DEnumMap k v1 -> DEnumMap k v2 Source #
mapMaybeWithKey :: Enum1 k => (forall (a :: kind). k a -> v1 a -> Maybe (v2 a)) -> DEnumMap k v1 -> DEnumMap k v2 Source #
mapEither :: forall {kind} (k :: kind -> Type) v1 v2 v3. Enum1 k => (forall (a :: kind). v1 a -> Either (v2 a) (v3 a)) -> DEnumMap k v1 -> (DEnumMap k v2, DEnumMap k v3) Source #
mapEitherWithKey :: Enum1 k => (forall (a :: kind). k a -> v1 a -> Either (v2 a) (v3 a)) -> DEnumMap k v1 -> (DEnumMap k v2, DEnumMap k v3) Source #
split :: forall {kind} k (a :: kind) (v :: kind -> Type). Enum1 k => k a -> DEnumMap k v -> (DEnumMap k v, DEnumMap k v) Source #
splitLookup :: forall {kind} k (a :: kind) v. Enum1 k => k a -> DEnumMap k v -> (DEnumMap k v, Maybe (v a), DEnumMap k v) Source #
splitRoot :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). DEnumMap k v -> [DEnumMap k v] Source #
Submap
isSubmapOf :: forall {kind} (v :: kind -> Type) (k :: kind -> Type). (forall (a :: kind). Eq (v a)) => DEnumMap k v -> DEnumMap k v -> Bool Source #
isSubmapOfBy :: forall {kind} v1 v2 (k :: kind -> Type). (forall (a :: kind). v1 a -> v2 a -> Bool) -> DEnumMap k v1 -> DEnumMap k v2 -> Bool Source #
isProperSubmapOf :: forall {kind} (v :: kind -> Type) (k :: kind -> Type). (forall (a :: kind). Eq (v a)) => DEnumMap k v -> DEnumMap k v -> Bool Source #
isProperSubmapOfBy :: forall {kind} v1 v2 (k :: kind -> Type). (forall (a :: kind). v1 a -> v2 a -> Bool) -> DEnumMap k v1 -> DEnumMap k v2 -> Bool Source #
Min/Max
lookupMin :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). Enum1 k2 => DEnumMap k2 v -> Maybe (DSum k2 v) Source #
lookupMax :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). Enum1 k2 => DEnumMap k2 v -> Maybe (DSum k2 v) Source #
findMin :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). Enum1 k2 => DEnumMap k2 v -> DSum k2 v Source #
findMax :: forall {k1} (k2 :: k1 -> Type) (v :: k1 -> Type). Enum1 k2 => DEnumMap k2 v -> DSum k2 v Source #
deleteMin :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). DEnumMap k v -> DEnumMap k v Source #
deleteMax :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). DEnumMap k v -> DEnumMap k v Source #
deleteFindMin :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). Enum1 k => DEnumMap k v -> (DSum k v, DEnumMap k v) Source #
deleteFindMax :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). Enum1 k => DEnumMap k v -> (DSum k v, DEnumMap k v) Source #
updateMin :: forall {kind} (k :: kind -> Type) v. Enum1 k => (forall (a :: kind). v a -> Maybe (v a)) -> DEnumMap k v -> DEnumMap k v Source #
updateMinWithKey :: Enum1 k => (forall (a :: kind). k a -> v a -> Maybe (v a)) -> DEnumMap k v -> DEnumMap k v Source #
updateMax :: forall {kind} (k :: kind -> Type) v. Enum1 k => (forall (a :: kind). v a -> Maybe (v a)) -> DEnumMap k v -> DEnumMap k v Source #
updateMaxWithKey :: Enum1 k => (forall (a :: kind). k a -> v a -> Maybe (v a)) -> DEnumMap k v -> DEnumMap k v Source #
minView :: forall {kind} (k :: kind -> Type) v (a :: kind). DEnumMap k v -> Maybe (v a, DEnumMap k v) Source #
maxView :: forall {kind} (k :: kind -> Type) v (a :: kind). DEnumMap k v -> Maybe (v a, DEnumMap k v) Source #
minViewWithKey :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). Enum1 k => DEnumMap k v -> Maybe (DSum k v, DEnumMap k v) Source #
maxViewWithKey :: forall {kind} (k :: kind -> Type) (v :: kind -> Type). Enum1 k => DEnumMap k v -> Maybe (DSum k v, DEnumMap k v) Source #
Helpers
typeCheck1 :: forall {k1} k2 (a :: k1) r. (Enum1 k2, TestEquality k2) => k2 a -> Int -> Enum1Info k2 -> r -> r Source #
typeCheck2 :: forall {k1} (k2 :: k1 -> Type) proxy r. (Enum1 k2, TestEquality k2) => proxy k2 -> Int -> Enum1Info k2 -> Enum1Info k2 -> r -> r Source #