2{-# LANGUAGE DeriveFunctor #-}
3{-# LANGUAGE DeriveGeneric #-}
4{-# LANGUAGE DeriveTraversable #-}
5{-# LANGUAGE FlexibleContexts #-}
6{-# LANGUAGE FlexibleInstances #-}
7{-# LANGUAGE GeneralizedNewtypeDeriving #-}
8{-# LANGUAGE MultiParamTypeClasses #-}
9{-# LANGUAGE PatternSynonyms #-}
10{-# LANGUAGE RoleAnnotations #-}
11{-# LANGUAGE ScopedTypeVariables #-}
12{-# LANGUAGE StandaloneDeriving #-}
13{-# LANGUAGE TypeFamilies #-}
14{-# OPTIONS_GHC -fno-warn-orphans #-}
15-- | 'Data.Map' with a better 'Monoid' instance
17-- 'Data.Map' has @mappend = union@, which is left-biased. AppendMap has
18-- @mappend = unionWith mappend@ instead.
20 ( module Data.AppendMap
21 , module Data.Map.Monoidal
24import Prelude hiding (map, null)
29#if MIN_VERSION_containers(0,5,11)
30import qualified Data.Map.Internal.Debug as Map (showTree, showTreeWith)
32import qualified Data.Map as Map (showTree, showTreeWith)
34import Reflex.Patch (Additive, Group (..))
35import Data.Map.Monoidal hiding (mapMaybe)
36import qualified Data.Map.Monoidal as M
37import Data.Witherable (Filterable(..))
39{-# DEPRECATED AppendMap "Use 'MonoidalMap' instead" #-}
40type AppendMap = MonoidalMap
42{-# DEPRECATED _unAppendMap "Use 'getMonoidalMap' instead" #-}
43_unAppendMap :: MonoidalMap k v -> Map k v
44_unAppendMap = getMonoidalMap
46pattern AppendMap :: Map k v -> MonoidalMap k v
47pattern AppendMap m = MonoidalMap m
49instance Filterable (MonoidalMap k) where
52-- | Deletes a key, returning 'Nothing' if the result is empty.
53nonEmptyDelete :: Ord k => k -> MonoidalMap k a -> Maybe (MonoidalMap k a)
55 let deleted = delete k vs
60mapMaybeNoNull :: (a -> Maybe b)
61 -> MonoidalMap token a
62 -> Maybe (MonoidalMap token b)
64 let bs = mapMaybe f as
69-- TODO: Move instances to `Reflex.Patch`
70instance (Ord k, Group q) => Group (MonoidalMap k q) where
73instance (Ord k, Additive q) => Additive (MonoidalMap k q)
75showTree :: forall k a. (Show k, Show a) => MonoidalMap k a -> String
76showTree = coerce (Map.showTree :: Map k a -> String)
78showTreeWith :: forall k a. (k -> a -> String) -> Bool -> Bool -> MonoidalMap k a -> String
79showTreeWith = coerce (Map.showTreeWith :: (k -> a -> String) -> Bool -> Bool -> Map k a -> String)
81instance Default (MonoidalMap k a) where
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