Hoogle Search
Within Stackage Nightly 2025-10-09 (ghc-9.12.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
fromSet :: (Int -> a) -> IntSet -> MonoidalIntMap amonoidal-containers Data.IntMap.Monoidal.Strict No documentation available.
keysSet :: MonoidalIntMap a -> IntSetmonoidal-containers Data.IntMap.Monoidal.Strict No documentation available.
fromSet :: (k -> a) -> Set k -> MonoidalMap k amonoidal-containers Data.Map.Monoidal No documentation available.
keysSet :: MonoidalMap k a -> Set kmonoidal-containers Data.Map.Monoidal No documentation available.
fromSet :: (k -> a) -> Set k -> MonoidalMap k amonoidal-containers Data.Map.Monoidal.Strict No documentation available.
keysSet :: MonoidalMap k a -> Set kmonoidal-containers Data.Map.Monoidal.Strict No documentation available.
fromSet :: (Key -> a) -> NEIntSet -> NEIntMap anonempty-containers Data.IntMap.NonEmpty O(n). Build a non-empty map from a non-empty set of keys and a function which for each key computes its value.
fromSet (\k -> replicate k 'a') (Data.Set.NonEmpty.fromList (3 :| [5])) == fromList ((5,"aaaaa") :| [(3,"aaa")])
keysSet :: NEIntMap a -> NEIntSetnonempty-containers Data.IntMap.NonEmpty O(n). The non-empty set of all keys of the map.
keysSet (fromList ((5,"a") :| [(3,"b")])) == Data.Set.NonEmpty.fromList (3 :| [5])
-
nonempty-containers Data.IntSet.NonEmpty A non-empty (by construction) set of integers. At least one value exists in an NEIntSet a at all times. Functions that take an NEIntSet can safely operate on it with the assumption that it has at least one item. Functions that return an NEIntSet provide an assurance that the result has at least one item. Data.IntSet.NonEmpty re-exports the API of Data.IntSet, faithfully reproducing asymptotics, typeclass constraints, and semantics. Functions that ensure that input and output sets are both non-empty (like insert) return NEIntSet, but functions that might potentially return an empty map (like delete) return a IntSet instead. You can directly construct an NEIntSet with the API from Data.IntSet.NonEmpty; it's more or less the same as constructing a normal IntSet, except you don't have access to empty. There are also a few ways to construct an NEIntSet from a IntSet:
- The nonEmptySet smart constructor will convert a IntSet a into a Maybe (NEIntSet a), returning Nothing if the original IntSet was empty.
- You can use the insertIntSet family of functions to insert a value into a IntSet to create a guaranteed NEIntSet.
- You can use the IsNonEmpty and IsEmpty patterns to "pattern match" on a IntSet to reveal it as either containing a NEIntSet or an empty map.
- withNonEmpty offers a continuation-based interface for deconstructing a IntSet and treating it as if it were an NEIntSet.
insertSet :: Key -> IntSet -> NEIntSetnonempty-containers Data.IntSet.NonEmpty O(log n). Convert a IntSet into an NEIntSet by adding a value. Because of this, we know that the set must have at least one element, and so therefore cannot be empty. See insertSetMin for a version that is constant-time if the new value is strictly smaller than all values in the original set
insertSet 4 (Data.IntSet.fromList [5, 3]) == fromList (3 :| [4, 5]) insertSet 4 Data.IntSet.empty == singleton 4 "c"