A non-empty (by construction) map from integer keys to values a. At
least one key-value pair exists in an NEIntMap v at all times.
Functions that take an NEIntMap can safely operate on it with the assumption that it has at least one key-value pair.
Functions that return an NEIntMap provide an assurance that the result has at least one key-value pair.
Data.IntMap.NonEmpty.Lazy re-exports the API of Data.IntMap.Lazy, faithfully reproducing asymptotics, typeclass constraints, and semantics. Functions that ensure that input and output maps are both non-empty (like insert) return NEIntMap, but functions that might potentially return an empty map (like delete) return a IntMap instead.
You can directly construct an NEIntMap with the API from
Data.IntMap.NonEmpty.Lazy; it's more or less the same as constructing a normal
IntMap, except you don't have access to Data.IntMap.empty. There are also
a few ways to construct an NEIntMap from a IntMap:
The nonEmptyMap smart constructor will convert a
IntMap k ainto aMaybe (NEIntMap k a), returning Nothing if the original IntMap was empty.You can use the
Data.IntMap.NonEmpty.insertIntMapfamily of functions to insert a value into a IntMap to create a guaranteed NEIntMap.You can use the IsNonEmpty and IsEmpty patterns to "pattern match" on a IntMap to reveal it as either containing a NEIntMap or an empty map.
withNonEmpty offers a continuation-based interface for deconstructing a IntMap and treating it as if it were an NEIntMap.
You can convert an NEIntMap into a IntMap with toMap or IsNonEmpty, essentially "obscuring" the non-empty property from the type.
Instances27Functor, Foldable, Traversable, Foldable1, Eq1, Ord1, …
Functor NEIntMapDefined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalFoldable NEIntMapDefined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalTraversable NEIntMapDefined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalFoldable1 NEIntMapDefined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalEq1 NEIntMapDefined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalOrd1 NEIntMapDefined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalRead1 NEIntMapDefined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalShow1 NEIntMapDefined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalComonad NEIntMapDefined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalAlt NEIntMapDefined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalTraversable1 NEIntMapDefined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalInvariant NEIntMapDefined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalFoldableWithIndex Int NEIntMapDefined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalFunctorWithIndex Int NEIntMapDefined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalTraversableWithIndex Int NEIntMapDefined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalIsList (NEIntMap a)Defined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalEq a => Eq (NEIntMap a)Defined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalData a => Data (NEIntMap a)Defined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalOrd a => Ord (NEIntMap a)Defined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalRead e => Read (NEIntMap e)Defined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalShow a => Show (NEIntMap a)Defined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalSemigroup (NEIntMap a)Defined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalLeft-biased union
NFData a => NFData (NEIntMap a)Defined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalFromJSON a => FromJSON (NEIntMap a)Defined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalToJSON a => ToJSON (NEIntMap a)Defined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.InternalIsNonEmptyList (NEIntMap a)Defined in nonempty-containers-0.4.0.0 · Data.Containers.NonEmpty.Listtype Item (NEIntMap a) = (Key, a)Defined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.Internal