non-empty-0.3.5: List-like structures with static restrictions on the number of elements
Safe HaskellSafe-Inferred
LanguageHaskell98

Data.NonEmpty.Map

Synopsis

Documentation

data T k a Source #

Instances

Instances details
Ord k => Foldable (T k) Source # 
Instance details

Defined in Data.NonEmpty.Map

Methods

fold :: Monoid m => T k m -> m #

foldMap :: Monoid m => (a -> m) -> T k a -> m #

foldMap' :: Monoid m => (a -> m) -> T k a -> m #

foldr :: (a -> b -> b) -> b -> T k a -> b #

foldr' :: (a -> b -> b) -> b -> T k a -> b #

foldl :: (b -> a -> b) -> b -> T k a -> b #

foldl' :: (b -> a -> b) -> b -> T k a -> b #

foldr1 :: (a -> a -> a) -> T k a -> a #

foldl1 :: (a -> a -> a) -> T k a -> a #

toList :: T k a -> [a] #

null :: T k a -> Bool #

length :: T k a -> Int #

elem :: Eq a => a -> T k a -> Bool #

maximum :: Ord a => T k a -> a #

minimum :: Ord a => T k a -> a #

sum :: Num a => T k a -> a #

product :: Num a => T k a -> a #

Ord k => Traversable (T k) Source # 
Instance details

Defined in Data.NonEmpty.Map

Methods

traverse :: Applicative f => (a -> f b) -> T k a -> f (T k b) #

sequenceA :: Applicative f => T k (f a) -> f (T k a) #

mapM :: Monad m => (a -> m b) -> T k a -> m (T k b) #

sequence :: Monad m => T k (m a) -> m (T k a) #

Ord k => Functor (T k) Source # 
Instance details

Defined in Data.NonEmpty.Map

Methods

fmap :: (a -> b) -> T k a -> T k b #

(<$) :: a -> T k b -> T k a #

(Arbitrary k, Ord k) => Arbitrary (T k) Source # 
Instance details

Defined in Data.NonEmpty.Map

Methods

arbitrary :: Arbitrary a => Gen (T k a) Source #

shrink :: Arbitrary a => T k a -> [T k a] Source #

(Arbitrary k, Ord k) => Gen (T k) Source # 
Instance details

Defined in Data.NonEmpty.Map

Methods

genOf :: Gen a -> Gen (T k a) Source #

NFData k => NFData (T k) Source # 
Instance details

Defined in Data.NonEmpty.Map

Methods

rnf :: NFData a => T k a -> () Source #

(Arbitrary k, Ord k, Arbitrary a) => Arbitrary (T k a) Source # 
Instance details

Defined in Data.NonEmpty.Map

Methods

arbitrary :: Gen (T k a) #

shrink :: T k a -> [T k a] #

(Show k, Show a) => Show (T k a) Source # 
Instance details

Defined in Data.NonEmpty.Map

Methods

showsPrec :: Int -> T k a -> ShowS #

show :: T k a -> String #

showList :: [T k a] -> ShowS #

(NFData k, NFData a) => NFData (T k a) Source # 
Instance details

Defined in Data.NonEmpty.Map

Methods

rnf :: T k a -> () #

(Eq k, Eq a) => Eq (T k a) Source # 
Instance details

Defined in Data.NonEmpty.Map

Methods

(==) :: T k a -> T k a -> Bool #

(/=) :: T k a -> T k a -> Bool #

(Ord k, Ord a) => Ord (T k a) Source # 
Instance details

Defined in Data.NonEmpty.Map

Methods

compare :: T k a -> T k a -> Ordering #

(<) :: T k a -> T k a -> Bool #

(<=) :: T k a -> T k a -> Bool #

(>) :: T k a -> T k a -> Bool #

(>=) :: T k a -> T k a -> Bool #

max :: T k a -> T k a -> T k a #

min :: T k a -> T k a -> T k a #

insert :: Ord k => k -> a -> Map k a -> T k a Source #

\k a -> forAllMap $ \m -> Map.insert k a m == NonEmptyMap.flatten (NonEmptyMap.insert k a m)

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

\k a -> forAllMap $ \m -> Map.insertWith (++) k a m == NonEmptyMap.flatten (NonEmptyMap.insertWith (++) k a m)

singleton :: k -> a -> T k a Source #

member :: Ord k => k -> T k a -> Bool Source #

size :: T k a -> Int Source #

elems :: T k a -> T [] a Source #

keys :: T k a -> T [] k Source #

keysSet :: Ord k => T k a -> T k Source #

lookup :: Ord k => k -> T k a -> Maybe a Source #

delete :: Ord k => k -> T k a -> Map k a Source #

\k -> forAllNonEmptyMap $ \m -> Map.delete k (NonEmptyMap.flatten m) == NonEmptyMap.delete k m

minViewWithKey :: T k a -> ((k, a), Map k a) Source #

maxViewWithKey :: Ord k => T k a -> ((k, a), Map k a) Source #

fromList :: Ord k => T [] (k, a) -> T k a Source #

Warning: Dangerous because it silently drops colliding key/value pairs. Better use fromListWith.

\xs -> Map.fromList (NonEmpty.flatten xs) == NonEmptyMap.flatten (NonEmptyMap.fromList (xs::NonEmpty.T [] (Int,Char)))

fromListWith :: Ord k => (a -> a -> a) -> T [] (k, a) -> T k a Source #

\xs -> Map.fromListWith (++) (NonEmpty.flatten xs) == NonEmptyMap.flatten (NonEmptyMap.fromListWith (++) (xs::NonEmpty.T [] (Int,String)))

fromAscList :: Ord k => T [] (k, a) -> T k a Source #

forAllNonEmptyMap $ \m -> NonEmptyMap.fromAscList (NonEmptyMap.toAscList m) == m

toAscList :: T k a -> T [] (k, a) Source #

forAllNonEmptyMap $ \m -> NonEmpty.flatten (NonEmptyMap.toAscList m) == Map.toAscList (NonEmptyMap.flatten m)

fetch :: Ord k => Map k a -> Maybe (T k a) Source #

flatten :: Ord k => T k a -> Map k a Source #

union :: Ord k => T k a -> T k a -> T k a Source #

Warning: Dangerous because it silently drops colliding key/value pairs. Better use unionWith.

forAllNonEmptyMap $ \xs -> forAllNonEmptyMap $ \ys -> Map.union (NonEmptyMap.flatten xs) (NonEmptyMap.flatten ys) == NonEmptyMap.flatten (NonEmptyMap.union xs ys)

unionLeft :: Ord k => Map k a -> T k a -> T k a Source #

Warning: Dangerous because it silently drops colliding key/value pairs. Better use unionLeftWith.

forAllMap $ \xm -> forAllNonEmptyMap $ \ym -> Map.union xm (NonEmptyMap.flatten ym) == NonEmptyMap.flatten (NonEmptyMap.unionLeft xm ym)

unionRight :: Ord k => T k a -> Map k a -> T k a Source #

Warning: Dangerous because it silently drops colliding key/value pairs. Better use unionRightWith.

forAllNonEmptyMap $ \xm -> forAllMap $ \ym -> Map.union (NonEmptyMap.flatten xm) ym == NonEmptyMap.flatten (NonEmptyMap.unionRight xm ym)

unionWith :: Ord k => (a -> a -> a) -> T k a -> T k a -> T k a Source #

forAllNonEmptyMap $ \xs -> forAllNonEmptyMap $ \ys -> Map.unionWith (++) (NonEmptyMap.flatten xs) (NonEmptyMap.flatten ys) == NonEmptyMap.flatten (NonEmptyMap.unionWith (++) xs ys)

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

forAllMap $ \xm -> forAllNonEmptyMap $ \ym -> Map.unionWith (++) xm (NonEmptyMap.flatten ym) == NonEmptyMap.flatten (NonEmptyMap.unionLeftWith (++) xm ym)

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

forAllNonEmptyMap $ \xm -> forAllMap $ \ym -> Map.unionWith (++) (NonEmptyMap.flatten xm) ym == NonEmptyMap.flatten (NonEmptyMap.unionRightWith (++) xm ym)

map :: Ord k => (a -> b) -> T k a -> T k b Source #

mapWithKey :: Ord k => (k -> a -> b) -> T k a -> T k b Source #