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 Data.Map.Monoidal
35import Reflex.Class (FunctorMaybe (..))
36import Reflex.Patch (Additive, Group (..))
38{-# DEPRECATED AppendMap "Use 'MonoidalMap' instead" #-}
39type AppendMap = MonoidalMap
41{-# DEPRECATED _unAppendMap "Use 'getMonoidalMap' instead" #-}
42_unAppendMap :: MonoidalMap k v -> Map k v
43_unAppendMap = getMonoidalMap
45pattern AppendMap :: Map k v -> MonoidalMap k v
46pattern AppendMap m = MonoidalMap m
48instance FunctorMaybe (MonoidalMap k) where
51-- | Deletes a key, returning 'Nothing' if the result is empty.
52nonEmptyDelete :: Ord k => k -> MonoidalMap k a -> Maybe (MonoidalMap k a)
54 let deleted = delete k vs
59mapMaybeNoNull :: (a -> Maybe b)
60 -> MonoidalMap token a
61 -> Maybe (MonoidalMap token b)
63 let bs = fmapMaybe f as
68-- TODO: Move instances to `Reflex.Patch`
69instance (Ord k, Group q) => Group (MonoidalMap k q) where
72instance (Ord k, Additive q) => Additive (MonoidalMap k q)
74showTree :: forall k a. (Show k, Show a) => MonoidalMap k a -> String
75showTree = coerce (Map.showTree :: Map k a -> String)
77showTreeWith :: forall k a. (k -> a -> String) -> Bool -> Bool -> MonoidalMap k a -> String
78showTreeWith = coerce (Map.showTreeWith :: (k -> a -> String) -> Bool -> Bool -> Map k a -> String)
80instance 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