on 997a479 help sign in
patch/src/Data/AppendMap.hs
408 lines 19 kB history raw
1{-# LANGUAGE DeriveFunctor #-}
2{-# LANGUAGE DeriveGeneric #-}
3{-# LANGUAGE DeriveTraversable #-}
4{-# LANGUAGE FlexibleContexts #-}
5{-# LANGUAGE FlexibleInstances #-}
6{-# LANGUAGE GeneralizedNewtypeDeriving #-}
7{-# LANGUAGE MultiParamTypeClasses #-}
8{-# LANGUAGE RoleAnnotations #-}
9{-# LANGUAGE ScopedTypeVariables #-}
10{-# LANGUAGE TypeFamilies #-}
11-- | 'Data.Map' with a better 'Monoid' instance
12--
13-- 'Data.Map' has @mappend = union@, which is left-biased. AppendMap has
14-- @mappend = unionWith mappend@ instead.
15module Data.AppendMap where
17import Prelude hiding (map)
19import Control.Lens
20import Data.Align
21import Data.Coerce
22import Data.Default
23import Data.Map (Map)
24import qualified Data.Map as Map
25import Data.Semigroup
26import Data.Set (Set)
27import Data.Typeable
28import GHC.Generics (Generic)
29import Reflex.Class (FunctorMaybe (..))
30import Reflex.Patch (Additive, Group (..))
32newtype AppendMap k m = AppendMap { _unAppendMap :: Map k m }
33 deriving (Eq, Ord, Show, Read, Typeable, Generic, Functor, Foldable, Traversable, Align)
35type instance (Index (AppendMap k m)) = k
36type instance (IxValue (AppendMap k m)) = m
38instance Ord k => Ixed (AppendMap k m) where
39 ix i = _Wrapped . ix i
41instance Ord k => At (AppendMap k m) where
42 at i = _Wrapped . at i
44instance FunctorMaybe (AppendMap k) where
45 fmapMaybe = mapMaybe
47-- | Deletes a key, returning 'Nothing' if the result is empty.
48nonEmptyDelete :: Ord k => k -> AppendMap k a -> Maybe (AppendMap k a)
49nonEmptyDelete k vs =
50 let deleted = delete k vs
51 in if Data.AppendMap.null deleted
52 then Nothing
53 else Just deleted
55mapMaybeNoNull :: (a -> Maybe b)
56 -> AppendMap token a
57 -> Maybe (AppendMap token b)
58mapMaybeNoNull f as =
59 let bs = fmapMaybe f as
60 in if Data.AppendMap.null bs
61 then Nothing
62 else Just bs
64instance FunctorWithIndex k (AppendMap k) where
65 imap f = AppendMap . imap f . _unAppendMap
66 imapped = _Wrapped . imapped
68instance FoldableWithIndex k (AppendMap k) where
69 ifolded = _Wrapped . ifolded
71instance TraversableWithIndex k (AppendMap k) where
72 itraverse = itraverseOf itraversed
73 itraversed = _Wrapped . itraversed
75instance (Ord k, Semigroup m) => Semigroup (AppendMap k m) where
76 (AppendMap m0) <> (AppendMap m1) = AppendMap $ Map.unionWith (<>) m0 m1
78instance (Ord k, Semigroup m) => Monoid (AppendMap k m) where
79 mempty = empty
80 mappend = (<>)
82instance (Ord k, Group q) => Group (AppendMap k q) where
83 negateG = map negateG
85instance (Ord k, Additive q) => Additive (AppendMap k q)
87(!) :: forall k a. Ord k => AppendMap k a -> k -> a
88(!) = coerce ((Map.!) :: Map k a -> k -> a)
89infixl 9 !
91(\\) :: forall k a b. Ord k => AppendMap k a -> AppendMap k b -> AppendMap k a
92(\\) = coerce ((Map.\\) :: Map k a -> Map k b -> Map k a)
93infixl 9 \\
95null :: forall k a. AppendMap k a -> Bool
96null = coerce (Map.null :: Map k a -> Bool)
98size :: forall k a. AppendMap k a -> Int
99size = coerce (Map.size :: Map k a -> Int)
101member :: forall k a. Ord k => k -> AppendMap k a -> Bool
102member = coerce (Map.member :: k -> Map k a -> Bool)
104notMember :: forall k a. Ord k => k -> AppendMap k a -> Bool
105notMember = coerce (Map.notMember :: k -> Map k a -> Bool)
107lookup :: forall k a. Ord k => k -> AppendMap k a -> Maybe a
108lookup = coerce (Map.lookup :: k -> Map k a -> Maybe a)
110findWithDefault :: forall k a. Ord k => a -> k -> AppendMap k a -> a
111findWithDefault = coerce (Map.findWithDefault :: a -> k -> Map k a -> a)
113lookupLT :: forall k a. Ord k => k -> AppendMap k a -> Maybe (k, a)
114lookupLT = coerce (Map.lookupLT :: k -> Map k a -> Maybe (k,a))
116lookupGT :: forall k a. Ord k => k -> AppendMap k a -> Maybe (k, a)
117lookupGT = coerce (Map.lookupGT :: k -> Map k a -> Maybe (k,a))
119lookupLE :: forall k a. Ord k => k -> AppendMap k a -> Maybe (k, a)
120lookupLE = coerce (Map.lookupLE :: k -> Map k a -> Maybe (k,a))
122lookupGE :: forall k a. Ord k => k -> AppendMap k a -> Maybe (k, a)
123lookupGE = coerce (Map.lookupGE :: k -> Map k a -> Maybe (k,a))
125empty :: forall k a. AppendMap k a
126empty = coerce (Map.empty :: Map k a)
128singleton :: forall k a. k -> a -> AppendMap k a
129singleton = coerce (Map.singleton :: k -> a -> Map k a)
131insert :: forall k a. Ord k => k -> a -> AppendMap k a -> AppendMap k a
132insert = coerce (Map.insert :: k -> a -> Map k a -> Map k a)
134insertWith :: forall k a. Ord k => (a -> a -> a) -> k -> a -> AppendMap k a -> AppendMap k a
135insertWith = coerce (Map.insertWith :: (a -> a -> a) -> k -> a -> Map k a -> Map k a)
137insertWithKey :: forall k a. Ord k => (k -> a -> a -> a) -> k -> a -> AppendMap k a -> AppendMap k a
138insertWithKey = coerce (Map.insertWithKey :: (k -> a -> a -> a) -> k -> a -> Map k a -> Map k a)
140insertLookupWithKey :: forall k a. Ord k => (k -> a -> a -> a) -> k -> a -> AppendMap k a -> (Maybe a, AppendMap k a)
141insertLookupWithKey = coerce (Map.insertLookupWithKey :: (k -> a -> a -> a) -> k -> a -> Map k a -> (Maybe a, Map k a))
143delete :: forall k a. Ord k => k -> AppendMap k a -> AppendMap k a
144delete = coerce (Map.delete :: k -> Map k a -> Map k a)
146adjust :: forall k a. Ord k => (a -> a) -> k -> AppendMap k a -> AppendMap k a
147adjust = coerce (Map.adjust :: (a -> a) -> k -> Map k a -> Map k a)
149adjustWithKey :: forall k a. Ord k => (k -> a -> a) -> k -> AppendMap k a -> AppendMap k a
150adjustWithKey = coerce (Map.adjustWithKey :: (k -> a -> a) -> k -> Map k a -> Map k a)
152update :: forall k a. Ord k => (a -> Maybe a) -> k -> AppendMap k a -> AppendMap k a
153update = coerce (Map.update :: (a -> Maybe a) -> k -> Map k a -> Map k a)
155updateWithKey :: forall k a. Ord k => (k -> a -> Maybe a) -> k -> AppendMap k a -> AppendMap k a
156updateWithKey = coerce (Map.updateWithKey :: (k -> a -> Maybe a) -> k -> Map k a -> Map k a)
158updateLookupWithKey :: forall k a. Ord k => (k -> a -> Maybe a) -> k -> AppendMap k a -> (Maybe a, AppendMap k a)
159updateLookupWithKey = coerce (Map.updateLookupWithKey :: (k -> a -> Maybe a) -> k -> Map k a -> (Maybe a, Map k a))
161alter :: forall k a. Ord k => (Maybe a -> Maybe a) -> k -> AppendMap k a -> AppendMap k a
162alter = coerce (Map.alter :: (Maybe a -> Maybe a) -> k -> Map k a -> Map k a)
164unionWith :: forall k a. Ord k => (a -> a -> a) -> AppendMap k a -> AppendMap k a -> AppendMap k a
165unionWith = coerce (Map.unionWith :: (a -> a -> a) -> Map k a -> Map k a -> Map k a)
167unionWithKey :: forall k a. Ord k => (k -> a -> a -> a) -> AppendMap k a -> AppendMap k a -> AppendMap k a
168unionWithKey = coerce (Map.unionWithKey :: (k -> a -> a -> a) -> Map k a -> Map k a -> Map k a)
170unionsWith :: forall k a. Ord k => (a -> a -> a) -> [AppendMap k a] -> AppendMap k a
171unionsWith = coerce (Map.unionsWith :: (a -> a -> a) -> [Map k a] -> Map k a)
173difference :: forall k a b. Ord k => AppendMap k a -> AppendMap k b -> AppendMap k a
174difference = (\\)
176differenceWith :: forall k a b. Ord k => (a -> b -> Maybe a) -> AppendMap k a -> AppendMap k b -> AppendMap k a
177differenceWith = coerce (Map.differenceWith :: (a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a)
179differenceWithKey :: forall k a b. Ord k => (k -> a -> b -> Maybe a) -> AppendMap k a -> AppendMap k b -> AppendMap k a
180differenceWithKey = coerce (Map.differenceWithKey :: (k -> a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a)
182intersectionWith :: forall k a b c. Ord k => (a -> b -> c) -> AppendMap k a -> AppendMap k b -> AppendMap k c
183intersectionWith = coerce (Map.intersectionWith :: (a -> b -> c) -> Map k a -> Map k b -> Map k c)
185intersectionWithKey :: forall k a b c. Ord k => (k -> a -> b -> c) -> AppendMap k a -> AppendMap k b -> AppendMap k c
186intersectionWithKey = coerce (Map.intersectionWithKey :: (k -> a -> b -> c) -> Map k a -> Map k b -> Map k c)
188mergeWithKey :: forall k a b c. Ord k => (k -> a -> b -> Maybe c) -> (AppendMap k a -> AppendMap k c) -> (AppendMap k b -> AppendMap k c) -> AppendMap k a -> AppendMap k b -> AppendMap k c
189mergeWithKey = coerce (Map.mergeWithKey :: (k -> a -> b -> Maybe c) -> (Map k a -> Map k c) -> (Map k b -> Map k c) -> Map k a -> Map k b -> Map k c)
191map :: (a -> b) -> AppendMap k a -> AppendMap k b
192map = fmap
194mapWithKey :: (k -> a -> b) -> AppendMap k a -> AppendMap k b
195mapWithKey = imap
197traverseWithKey :: Applicative t => (k -> a -> t b) -> AppendMap k a -> t (AppendMap k b)
198traverseWithKey = itraverse
200mapAccum :: forall k a b c. (a -> b -> (a, c)) -> a -> AppendMap k b -> (a, AppendMap k c)
201mapAccum = coerce (Map.mapAccum :: (a -> b -> (a, c)) -> a -> Map k b -> (a, Map k c))
203mapAccumWithKey :: forall k a b c. (a -> k -> b -> (a, c)) -> a -> AppendMap k b -> (a, AppendMap k c)
204mapAccumWithKey = coerce (Map.mapAccumWithKey :: (a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c))
206mapAccumRWithKey :: forall k a b c. (a -> k -> b -> (a, c)) -> a -> AppendMap k b -> (a, AppendMap k c)
207mapAccumRWithKey = coerce (Map.mapAccumRWithKey :: (a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c))
209mapKeys :: forall k1 k2 a. Ord k2 => (k1 -> k2) -> AppendMap k1 a -> AppendMap k2 a
210mapKeys = coerce (Map.mapKeys :: (k1 -> k2) -> Map k1 a -> Map k2 a)
212mapKeysWith :: forall k1 k2 a. Ord k2 => (a -> a -> a) -> (k1 -> k2) -> AppendMap k1 a -> AppendMap k2 a
213mapKeysWith = coerce (Map.mapKeysWith :: (a -> a -> a) -> (k1 -> k2) -> Map k1 a -> Map k2 a)
215mapKeysMonotonic :: forall k1 k2 a. (k1 -> k2) -> AppendMap k1 a -> AppendMap k2 a
216mapKeysMonotonic = coerce (Map.mapKeysMonotonic :: (k1 -> k2) -> Map k1 a -> Map k2 a)
218foldr :: forall k a b. (a -> b -> b) -> b -> AppendMap k a -> b
219foldr = coerce (Map.foldr :: (a -> b -> b) -> b -> Map k a -> b)
221foldl :: forall k a b. (a -> b -> a) -> a -> AppendMap k b -> a
222foldl = coerce (Map.foldl :: (a -> b -> a) -> a -> Map k b -> a)
224foldrWithKey :: forall k a b. (k -> a -> b -> b) -> b -> AppendMap k a -> b
225foldrWithKey = coerce (Map.foldrWithKey :: (k -> a -> b -> b) -> b -> Map k a -> b)
227foldlWithKey :: forall k a b. (a -> k -> b -> a) -> a -> AppendMap k b -> a
228foldlWithKey = coerce (Map.foldlWithKey :: (a -> k -> b -> a) -> a -> Map k b -> a)
230foldMapWithKey :: forall k a m. Monoid m => (k -> a -> m) -> AppendMap k a -> m
231foldMapWithKey = coerce (Map.foldMapWithKey :: Monoid m => (k -> a -> m) -> Map k a -> m)
233foldr' :: forall k a b. (a -> b -> b) -> b -> AppendMap k a -> b
234foldr' = coerce (Map.foldr' :: (a -> b -> b) -> b -> Map k a -> b)
236foldl' :: forall k a b. (a -> b -> a) -> a -> AppendMap k b -> a
237foldl' = coerce (Map.foldl' :: (a -> b -> a) -> a -> Map k b -> a)
239foldrWithKey' :: forall k a b. (k -> a -> b -> b) -> b -> AppendMap k a -> b
240foldrWithKey' = coerce (Map.foldrWithKey' :: (k -> a -> b -> b) -> b -> Map k a -> b)
242foldlWithKey' :: forall k a b. (a -> k -> b -> a) -> a -> AppendMap k b -> a
243foldlWithKey' = coerce (Map.foldlWithKey' :: (a -> k -> b -> a) -> a -> Map k b -> a)
245elems :: forall k a. AppendMap k a -> [a]
246elems = coerce (Map.elems :: Map k a -> [a])
248keys :: forall k a. AppendMap k a -> [k]
249keys = coerce (Map.keys :: Map k a -> [k])
251assocs :: forall k a. AppendMap k a -> [(k, a)]
252assocs = coerce (Map.assocs :: Map k a -> [(k, a)])
254keysSet :: forall k a. AppendMap k a -> Set k
255keysSet = coerce (Map.keysSet :: Map k a -> Set k)
257fromSet :: forall k a. (k -> a) -> Set k -> AppendMap k a
258fromSet = coerce (Map.fromSet :: (k -> a) -> Set k -> Map k a)
260toList :: forall k a. AppendMap k a -> [(k, a)]
261toList = coerce (Map.toList :: Map k a -> [(k, a)])
263fromList :: forall k a. Ord k => [(k, a)] -> AppendMap k a
264fromList = coerce (Map.fromList :: [(k, a)] -> Map k a)
266fromListWith :: forall k a. Ord k => (a -> a -> a) -> [(k, a)] -> AppendMap k a
267fromListWith = coerce (Map.fromListWith :: (a -> a -> a) -> [(k, a)] -> Map k a)
269fromListWithKey :: forall k a. Ord k => (k -> a -> a -> a) -> [(k, a)] -> AppendMap k a
270fromListWithKey = coerce (Map.fromListWithKey :: (k -> a -> a -> a) -> [(k, a)] -> Map k a)
272toAscList :: forall k a. AppendMap k a -> [(k, a)]
273toAscList = coerce (Map.toAscList :: Map k a -> [(k, a)])
275toDescList :: forall k a. AppendMap k a -> [(k, a)]
276toDescList = coerce (Map.toDescList :: Map k a -> [(k, a)])
278fromAscList :: forall k a. Eq k => [(k, a)] -> AppendMap k a
279fromAscList = coerce (Map.fromAscList :: [(k, a)] -> Map k a)
281fromAscListWith :: forall k a. Eq k => (a -> a -> a) -> [(k, a)] -> AppendMap k a
282fromAscListWith = coerce (Map.fromAscListWith :: (a -> a -> a) -> [(k, a)] -> Map k a)
284fromAscListWithKey :: forall k a. Eq k => (k -> a -> a -> a) -> [(k, a)] -> AppendMap k a
285fromAscListWithKey = coerce (Map.fromAscListWithKey :: (k -> a -> a -> a) -> [(k, a)] -> Map k a)
287fromDistinctAscList :: forall k a. [(k, a)] -> AppendMap k a
288fromDistinctAscList = coerce (Map.fromDistinctAscList :: [(k, a)] -> Map k a)
290filter :: forall k a. (a -> Bool) -> AppendMap k a -> AppendMap k a
291filter = coerce (Map.filter :: (a -> Bool) -> Map k a -> Map k a)
293filterWithKey :: forall k a. (k -> a -> Bool) -> AppendMap k a -> AppendMap k a
294filterWithKey = coerce (Map.filterWithKey :: (k -> a -> Bool) -> Map k a -> Map k a)
296partition :: forall k a. (a -> Bool) -> AppendMap k a -> (AppendMap k a, AppendMap k a)
297partition = coerce (Map.partition :: (a -> Bool) -> Map k a -> (Map k a, Map k a))
299partitionWithKey :: forall k a. (k -> a -> Bool) -> AppendMap k a -> (AppendMap k a, AppendMap k a)
300partitionWithKey = coerce (Map.partitionWithKey :: (k -> a -> Bool) -> Map k a -> (Map k a, Map k a))
302mapMaybe :: forall k a b. (a -> Maybe b) -> AppendMap k a -> AppendMap k b
303mapMaybe = coerce (Map.mapMaybe :: (a -> Maybe b) -> Map k a -> Map k b)
305mapMaybeWithKey :: forall k a b. (k -> a -> Maybe b) -> AppendMap k a -> AppendMap k b
306mapMaybeWithKey = coerce (Map.mapMaybeWithKey :: (k -> a -> Maybe b) -> Map k a -> Map k b)
308mapEither :: forall k a b c. (a -> Either b c) -> AppendMap k a -> (AppendMap k b, AppendMap k c)
309mapEither = coerce (Map.mapEither :: (a -> Either b c) -> Map k a -> (Map k b, Map k c))
311mapEitherWithKey :: forall k a b c. (k -> a -> Either b c) -> AppendMap k a -> (AppendMap k b, AppendMap k c)
312mapEitherWithKey = coerce (Map.mapEitherWithKey :: (k -> a -> Either b c) -> Map k a -> (Map k b, Map k c))
314split :: forall k a. Ord k => k -> AppendMap k a -> (AppendMap k a, AppendMap k a)
315split = coerce (Map.split :: k -> Map k a -> (Map k a, Map k a))
317splitLookup :: forall k a. Ord k => k -> AppendMap k a -> (AppendMap k a, Maybe a, AppendMap k a)
318splitLookup = coerce (Map.splitLookup :: k -> Map k a -> (Map k a, Maybe a, Map k a))
320splitRoot :: forall k a. AppendMap k a -> [AppendMap k a]
321splitRoot = coerce (Map.splitRoot :: Map k a -> [Map k a])
323isSubmapOf :: forall k a. (Ord k, Eq a) => AppendMap k a -> AppendMap k a -> Bool
324isSubmapOf = coerce (Map.isSubmapOf :: Map k a -> Map k a -> Bool)
326isSubmapOfBy :: forall k a b. Ord k => (a -> b -> Bool) -> AppendMap k a -> AppendMap k b -> Bool
327isSubmapOfBy = coerce (Map.isSubmapOfBy :: (a -> b -> Bool) -> Map k a -> Map k b -> Bool)
329isProperSubmapOf :: forall k a. (Ord k, Eq a) => AppendMap k a -> AppendMap k a -> Bool
330isProperSubmapOf = coerce (Map.isProperSubmapOf :: Map k a -> Map k a -> Bool)
332isProperSubmapOfBy :: forall k a b. Ord k => (a -> b -> Bool) -> AppendMap k a -> AppendMap k b -> Bool
333isProperSubmapOfBy = coerce (Map.isProperSubmapOfBy :: (a -> b -> Bool) -> Map k a -> Map k b -> Bool)
335lookupIndex :: forall k a. Ord k => k -> AppendMap k a -> Maybe Int
336lookupIndex = coerce (Map.lookupIndex :: k -> Map k a -> Maybe Int)
338findIndex :: forall k a. Ord k => k -> AppendMap k a -> Int
339findIndex = coerce (Map.findIndex :: k -> Map k a -> Int)
341elemAt :: forall k a. Int -> AppendMap k a -> (k, a)
342elemAt = coerce (Map.elemAt :: Int -> Map k a -> (k, a))
344updateAt :: forall k a. (k -> a -> Maybe a) -> Int -> AppendMap k a -> AppendMap k a
345updateAt = coerce (Map.updateAt :: (k -> a -> Maybe a) -> Int -> Map k a -> Map k a)
347deleteAt :: forall k a. Int -> AppendMap k a -> AppendMap k a
348deleteAt = coerce (Map.deleteAt :: Int -> Map k a -> Map k a)
350findMin :: forall k a. AppendMap k a -> (k, a)
351findMin = coerce (Map.findMin :: Map k a -> (k, a))
353findMax :: forall k a. AppendMap k a -> (k, a)
354findMax = coerce (Map.findMax :: Map k a -> (k, a))
356deleteMin :: forall k a. AppendMap k a -> AppendMap k a
357deleteMin = coerce (Map.deleteMin :: Map k a -> Map k a)
359deleteMax :: forall k a. AppendMap k a -> AppendMap k a
360deleteMax = coerce (Map.deleteMax :: Map k a -> Map k a)
362deleteFindMin :: forall k a. AppendMap k a -> ((k, a), AppendMap k a)
363deleteFindMin = coerce (Map.deleteFindMin :: Map k a -> ((k, a), Map k a))
365deleteFindMax :: forall k a. AppendMap k a -> ((k, a), AppendMap k a)
366deleteFindMax = coerce (Map.deleteFindMax :: Map k a -> ((k, a), Map k a))
368updateMin :: forall k a. (a -> Maybe a) -> AppendMap k a -> AppendMap k a
369updateMin = coerce (Map.updateMin :: (a -> Maybe a) -> Map k a -> Map k a)
371updateMax :: forall k a. (a -> Maybe a) -> AppendMap k a -> AppendMap k a
372updateMax = coerce (Map.updateMax :: (a -> Maybe a) -> Map k a -> Map k a)
374updateMinWithKey :: forall k a. (k -> a -> Maybe a) -> AppendMap k a -> AppendMap k a
375updateMinWithKey = coerce (Map.updateMinWithKey :: (k -> a -> Maybe a) -> Map k a -> Map k a)
377updateMaxWithKey :: forall k a. (k -> a -> Maybe a) -> AppendMap k a -> AppendMap k a
378updateMaxWithKey = coerce (Map.updateMaxWithKey :: (k -> a -> Maybe a) -> Map k a -> Map k a)
380minView :: forall k a. AppendMap k a -> Maybe (a, AppendMap k a)
381minView = coerce (Map.minView :: Map k a -> Maybe (a, Map k a))
383maxView :: forall k a. AppendMap k a -> Maybe (a, AppendMap k a)
384maxView = coerce (Map.maxView :: Map k a -> Maybe (a, Map k a))
386minViewWithKey :: forall k a. AppendMap k a -> Maybe ((k, a), AppendMap k a)
387minViewWithKey = coerce (Map.minViewWithKey :: Map k a -> Maybe ((k, a), Map k a))
389maxViewWithKey :: forall k a. AppendMap k a -> Maybe ((k, a), AppendMap k a)
390maxViewWithKey = coerce (Map.maxViewWithKey :: Map k a -> Maybe ((k, a), Map k a))
392showTree :: forall k a. (Show k, Show a) => AppendMap k a -> String
393showTree = coerce (Map.showTree :: (Show k, Show a) => Map k a -> String)
395showTreeWith :: forall k a. (k -> a -> String) -> Bool -> Bool -> AppendMap k a -> String
396showTreeWith = coerce (Map.showTreeWith :: (k -> a -> String) -> Bool -> Bool -> Map k a -> String)
398valid :: forall k a. Ord k => AppendMap k a -> Bool
399valid = coerce (Map.valid :: Ord k => Map k a -> Bool)
401instance Default (AppendMap k a) where
402 def = empty
404instance AppendMap k' v' ~ t => Rewrapped (AppendMap k a) t
406instance Wrapped (AppendMap k a) where
407 type Unwrapped (AppendMap k a) = Map k a
408 _Wrapped' = iso (\(AppendMap m) -> m) AppendMap