Agda
Safe HaskellNone
LanguageHaskell2010

Agda.Utils.Map

Synopsis

Monadic map operations

insertWithGood :: Ord k => (a -> a -> a) -> k -> a -> Map k a -> Map k a Source #

Version of insertWith that's willing to be properly inlined.

forGood_ :: forall k v m. Applicative m => Map k v -> (v -> m ()) -> m () Source #

Version of forM_ that deigns to be properly lambda-lifted for State, Reader, etc.

forWithKey_ :: forall k v m. Applicative m => Map k v -> (k -> v -> m ()) -> m () Source #

adjustM :: (Functor f, Ord k) => (v -> f v) -> k -> Map k v -> f (Map k v) Source #

Update monadically the value at one position (must exist!).

adjustM' :: (Functor f, Ord k) => (v -> f (a, v)) -> k -> Map k v -> f (a, Map k v) Source #

Wrapper for adjustM for convenience.

Non-monadic map operations

filterKeys :: (k -> Bool) -> Map k a -> Map k a Source #

Filter a map based on the keys.

isSingleMap :: Map k v -> Maybe (k, v) Source #

Check whether a map is a singleton.