2{-# LANGUAGE FlexibleContexts #-}
3{-# LANGUAGE FlexibleInstances #-}
4{-# LANGUAGE MultiParamTypeClasses #-}
5{-# LANGUAGE PatternSynonyms #-}
6{-# LANGUAGE RoleAnnotations #-}
7{-# LANGUAGE ScopedTypeVariables #-}
8{-# LANGUAGE TypeFamilies #-}
9{-# OPTIONS_GHC -fno-warn-orphans #-}
10-- | 'Data.Map' with a better 'Monoid' instance
12-- 'Data.Map' has @mappend = union@, which is left-biased. AppendMap has
13-- @mappend = unionWith mappend@ instead.
15 ( module Data.AppendMap
16 , module Data.Map.Monoidal
19import Prelude hiding (map, null)
24#if MIN_VERSION_containers(0,5,11)
25import qualified Data.Map.Internal.Debug as Map (showTree, showTreeWith)
27import qualified Data.Map as Map (showTree, showTreeWith)
29import Data.Map.Monoidal
30import Reflex.Class (FunctorMaybe (..))
32{-# DEPRECATED AppendMap "Use 'MonoidalMap' instead" #-}
33type AppendMap = MonoidalMap
35{-# DEPRECATED _unAppendMap "Use 'getMonoidalMap' instead" #-}
36_unAppendMap :: MonoidalMap k v -> Map k v
37_unAppendMap = getMonoidalMap
39pattern AppendMap :: Map k v -> MonoidalMap k v
40pattern AppendMap m = MonoidalMap m
42instance FunctorMaybe (MonoidalMap k) where
45-- | Deletes a key, returning 'Nothing' if the result is empty.
46nonEmptyDelete :: Ord k => k -> MonoidalMap k a -> Maybe (MonoidalMap k a)
48 let deleted = delete k vs
53mapMaybeNoNull :: (a -> Maybe b)
54 -> MonoidalMap token a
55 -> Maybe (MonoidalMap token b)
57 let bs = fmapMaybe f as
62-- TODO: Move instances to `Reflex.Patch`
63showTree :: forall k a. (Show k, Show a) => MonoidalMap k a -> String
64showTree = coerce (Map.showTree :: Map k a -> String)
66showTreeWith :: forall k a. (k -> a -> String) -> Bool -> Bool -> MonoidalMap k a -> String
67showTreeWith = coerce (Map.showTreeWith :: (k -> a -> String) -> Bool -> Bool -> Map k a -> String)
69instance 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