monoidmap-internal
Copyright© 2022–2026 Jonathan Knowles
LicenseApache-2.0
Safe HaskellNone
LanguageHaskell2010

Data.MonoidMap.Internal.NonNullMap

Description

Provides the NonNullMap type and related functions.

This module is intended to be imported qualified:

import Data.MonoidMap.Internal.NonNullMap (NonNullMap (..))
import Data.MonoidMap.Internal.NonNullMap qualified as NonNullMap
Synopsis

Type

newtype NonNullMap k v Source #

A map of NonNull values.

Other types with the same representation (such as MonoidMap from the monoidmap package) can derive instances via this type, without access to the data constructor of NonNull.

Constructors

NonNullMap (Map k (NonNull v)) 

Instances

Instances details
Bifoldable NonNullMap Source # 
Instance details

Defined in Data.MonoidMap.Internal.NonNullMap.Unsafe

Methods

bifold :: Monoid m => NonNullMap m m -> m #

bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> NonNullMap a b -> m #

bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> NonNullMap a b -> c #

bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> NonNullMap a b -> c #

Eq2 NonNullMap Source # 
Instance details

Defined in Data.MonoidMap.Internal.NonNullMap.Unsafe

Methods

liftEq2 :: (a -> b -> Bool) -> (c -> d -> Bool) -> NonNullMap a c -> NonNullMap b d -> Bool #

Show2 NonNullMap Source # 
Instance details

Defined in Data.MonoidMap.Internal.NonNullMap.Unsafe

Methods

liftShowsPrec2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> NonNullMap a b -> ShowS #

liftShowList2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> [NonNullMap a b] -> ShowS #

Eq k => Eq1 (NonNullMap k) Source # 
Instance details

Defined in Data.MonoidMap.Internal.NonNullMap.Unsafe

Methods

liftEq :: (a -> b -> Bool) -> NonNullMap k a -> NonNullMap k b -> Bool #

Show k => Show1 (NonNullMap k) Source # 
Instance details

Defined in Data.MonoidMap.Internal.NonNullMap.Unsafe

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> NonNullMap k a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [NonNullMap k a] -> ShowS #

Foldable (NonNullMap k) Source # 
Instance details

Defined in Data.MonoidMap.Internal.NonNullMap.Unsafe

Methods

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

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

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

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

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

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

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

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

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

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

null :: NonNullMap k a -> Bool #

length :: NonNullMap k a -> Int #

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

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

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

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

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

(NFData k, NFData v) => NFData (NonNullMap k v) Source # 
Instance details

Defined in Data.MonoidMap.Internal.NonNullMap.Unsafe

Methods

rnf :: NonNullMap k v -> () #

(Eq k, Eq v) => Eq (NonNullMap k v) Source # 
Instance details

Defined in Data.MonoidMap.Internal.NonNullMap.Unsafe

Methods

(==) :: NonNullMap k v -> NonNullMap k v -> Bool #

(/=) :: NonNullMap k v -> NonNullMap k v -> Bool #

(Show k, Show v) => Show (NonNullMap k v) Source # 
Instance details

Defined in Data.MonoidMap.Internal.NonNullMap.Unsafe

Methods

showsPrec :: Int -> NonNullMap k v -> ShowS #

show :: NonNullMap k v -> String #

showList :: [NonNullMap k v] -> ShowS #

Construction

fromMap :: MonoidNull v => Map k v -> NonNullMap k v Source #

Constructs a NonNullMap from an ordinary Map, removing all null values.

This function selects which of the implementations in Data.MonoidMap.Internal.NonNullMap.FromMap is used by the public fromMap function of the monoidmap package.

fromMapWith :: MonoidNull v2 => (v1 -> v2) -> Map k v1 -> NonNullMap k v2 Source #

Constructs a NonNullMap from an ordinary Map, applying the given function to all values, and removing all null values.

This function selects which of the implementations in Data.MonoidMap.Internal.NonNullMap.FromMapWith is used by the public fromMapWith function of the monoidmap package.

Deconstruction

toMap :: NonNullMap k v -> Map k v Source #

Converts a NonNullMap into an ordinary map.

Lookup

get :: (Ord k, Monoid v) => k -> NonNullMap k v -> v Source #

Gets the value associated with the given key, returning mempty if the key is not present.

This function selects which of the implementations in Data.MonoidMap.Internal.NonNullMap.Get is used by the public get function of the monoidmap package.

Modification

adjust :: (Ord k, MonoidNull v) => (v -> v) -> k -> NonNullMap k v -> NonNullMap k v Source #

Applies the given function to the value associated with the given key (or to mempty if the key is not present), removing the key if the result is null.

This function selects which of the implementations in Data.MonoidMap.Internal.NonNullMap.Adjust is used by the public adjust function of the monoidmap package.