non-empty-0.3.3: List-like structures with static restrictions on the number of elements

Data.NonEmpty.Map

Synopsis

# Documentation

data T k a Source #

#### Instances

Instances details
 Ord k => Functor (T k) Source # Instance detailsDefined in Data.NonEmpty.Map Methodsfmap :: (a -> b) -> T k a -> T k b #(<$) :: a -> T k b -> T k a # Ord k => Foldable (T k) Source # Instance detailsDefined in Data.NonEmpty.Map Methodsfold :: 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 detailsDefined in Data.NonEmpty.Map Methodstraverse :: 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) # NFData k => NFData (T k) Source # Instance detailsDefined in Data.NonEmpty.Map Methodsrnf :: NFData a => T k a -> () Source # (Arbitrary k, Ord k) => Gen (T k) Source # Instance detailsDefined in Data.NonEmpty.Map MethodsgenOf :: Gen a -> Gen (T k a) Source # (Arbitrary k, Ord k) => Arbitrary (T k) Source # Instance detailsDefined in Data.NonEmpty.Map Methodsarbitrary :: Arbitrary a => Gen (T k a) Source #shrink :: Arbitrary a => T k a -> [T k a] Source # (Eq k, Eq a) => Eq (T k a) Source # Instance detailsDefined 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 detailsDefined in Data.NonEmpty.Map Methodscompare :: 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 # (Show k, Show a) => Show (T k a) Source # Instance detailsDefined in Data.NonEmpty.Map MethodsshowsPrec :: Int -> T k a -> ShowS #show :: T k a -> String #showList :: [T k a] -> ShowS # (Arbitrary k, Ord k, Arbitrary a) => Arbitrary (T k a) Source # Instance detailsDefined in Data.NonEmpty.Map Methodsarbitrary :: Gen (T k a) #shrink :: T k a -> [T k a] # (NFData k, NFData a) => NFData (T k a) Source # Instance detailsDefined in Data.NonEmpty.Map Methodsrnf :: 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 #

\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 #

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 #

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 #

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 #