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.Kind (Type)
12import Data.Map.Strict (Map)
14import qualified Data.IntMap.Strict as IntMap
15import qualified Data.Map.Strict as Map
17-- XXX Try unpacked-containers
23 mapAlterF :: Functor g =>
24 (Maybe a -> g (Maybe a)) -> Key f -> f a -> g (f a)
25 -- These can be implemented in terms of alterF itself
26 mapLookup :: Key f -> f a -> Maybe a
27 mapInsert :: Key f -> a -> f a -> f a
28 mapDelete :: Key f -> f a -> f a
29 mapUnion :: f a -> f a -> f a
30 mapNull :: f a -> Bool
32 Applicative t => (Key f -> a -> t b) -> f a -> t (f b)
34instance Ord k => IsMap (Map k) where
38 mapAlterF = Map.alterF
39 mapLookup = Map.lookup
40 mapInsert = Map.insert
41 mapDelete = Map.delete
44 mapTraverseWithKey = Map.traverseWithKey
46instance IsMap IntMap.IntMap where
47 type Key IntMap.IntMap = Int
49 mapEmpty = IntMap.empty
50 mapAlterF = IntMap.alterF
51 mapLookup = IntMap.lookup
52 mapInsert = IntMap.insert
53 mapDelete = IntMap.delete
54 mapUnion = IntMap.union
56 mapTraverseWithKey = IntMap.traverseWithKey
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