2-- Module : Streamly.Internal.Data.IsMap
3-- Copyright : (c) 2022 Composewell Technologies
4-- License : BSD-3-Clause
5-- Maintainer : streamly@composewell.com
6-- Stability : experimental
9module Streamly.Internal.Data.IsMap (IsMap(..)) where
11import Data.Hashable (Hashable)
12import Data.Kind (Type)
13import Data.Map.Strict (Map)
15import qualified Data.HashMap.Strict as HashMap
16import qualified Data.IntMap.Strict as IntMap
17import qualified Data.Map.Strict as Map
19-- XXX Try unpacked-containers
25 mapAlterF :: Functor g =>
26 (Maybe a -> g (Maybe a)) -> Key f -> f a -> g (f a)
27 -- These can be implemented in terms of alterF itself
28 mapLookup :: Key f -> f a -> Maybe a
29 mapInsert :: Key f -> a -> f a -> f a
30 mapDelete :: Key f -> f a -> f a
31 mapUnion :: f a -> f a -> f a
32 mapNull :: f a -> Bool
34instance Ord k => IsMap (Map k) where
38 mapAlterF = Map.alterF
39 mapLookup = Map.lookup
40 mapInsert = Map.insert
41 mapDelete = Map.delete
45instance IsMap IntMap.IntMap where
46 type Key IntMap.IntMap = Int
48 mapEmpty = IntMap.empty
49 mapAlterF = IntMap.alterF
50 mapLookup = IntMap.lookup
51 mapInsert = IntMap.insert
52 mapDelete = IntMap.delete
53 mapUnion = IntMap.union
56instance (Hashable k, Eq k) => IsMap (HashMap.HashMap k) where
57 type Key (HashMap.HashMap k) = k
59 mapEmpty = HashMap.empty
60 mapAlterF = HashMap.alterF
61 mapLookup = HashMap.lookup
62 mapInsert = HashMap.insert
63 mapDelete = HashMap.delete
64 mapUnion = HashMap.union
65 mapNull = HashMap.null
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list