bricks-internal-0.0.0.4: ...

Safe HaskellSafe
LanguageHaskell2010

Bricks.Internal.Map

Synopsis

Documentation

module Data.Map

exactKeys :: Ord k => Map k a -> Set k -> Either (Set k) (Map k a) Source #

If s is a subset of the keys in m then

m exactKeys s = Right (m `restrictKeys` s)

Otherwise, m exactKeys s = Left s' where s' is the keys that are missing from m.

Examples

>>> :{
>>> fromList [('a', 1), ('b', 2), ('c', 3)]
>>> `exactKeys` Set.fromList ['a', 'b']
>>> :}
Right (fromList [('a',1),('b',2)])
>>> :{
>>> fromList [('a', 1), ('b', 2), ('c', 3)]
>>> `exactKeys` Set.fromList ['a', 'x', 'y']
>>> :}
Left (fromList "xy")

restrictKeys :: Ord k => Map k a -> Set k -> Map k a Source #

This function was added in containers version 0.5.8 which we're not using yet.