Hoogle Search

Within Stackage Nightly 2025-10-05 (ghc-9.12.2)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. NEIntSet :: Key -> IntSet -> NEIntSet

    nonempty-containers Data.IntSet.NonEmpty.Internal

    No documentation available.

  2. insertMaxSet :: Key -> IntSet -> IntSet

    nonempty-containers Data.IntSet.NonEmpty.Internal

    O(log n). Insert new value into a set where values are /strictly less than the new value. That is, the new value must be strictly greater than all values present in the IntSet. The precondition is not checked./ At the moment this is simply an alias for Data.IntSet.insert, but it's left here as a placeholder in case this eventually gets implemented in a more efficient way.

  3. insertMinSet :: Key -> IntSet -> IntSet

    nonempty-containers Data.IntSet.NonEmpty.Internal

    O(log n). Insert new value into a set where values are strictly greater than the new values That is, the new value must be strictly less than all values present in the IntSet. /The precondition is not checked./ At the moment this is simply an alias for Data.IntSet.insert, but it's left here as a placeholder in case this eventually gets implemented in a more efficient way.

  4. neisIntSet :: NEIntSet -> !IntSet

    nonempty-containers Data.IntSet.NonEmpty.Internal

    No documentation available.

  5. nonEmptySet :: IntSet -> Maybe NEIntSet

    nonempty-containers Data.IntSet.NonEmpty.Internal

    O(log n). Smart constructor for an NEIntSet from a IntSet. Returns Nothing if the IntSet was originally actually empty, and Just n with an NEIntSet, if the IntSet was not empty. nonEmptySet and maybe empty toSet form an isomorphism: they are perfect structure-preserving inverses of eachother. See IsNonEmpty for a pattern synonym that lets you "match on" the possiblity of a IntSet being an NEIntSet.

    nonEmptySet (Data.IntSet.fromList [3,5]) == Just (fromList (3:|[5]))
    

  6. toSet :: NEIntSet -> IntSet

    nonempty-containers Data.IntSet.NonEmpty.Internal

    O(log n). Convert a non-empty set back into a normal possibly-empty map, for usage with functions that expect IntSet. Can be thought of as "obscuring" the non-emptiness of the set in its type. See the IsNotEmpty pattern. nonEmptySet and maybe empty toSet form an isomorphism: they are perfect structure-preserving inverses of eachother.

    toSet (fromList ((3,"a") :| [(5,"b")])) == Data.IntSet.fromList [(3,"a"), (5,"b")]
    

  7. fromSet :: (k -> a) -> NESet k -> NEMap k a

    nonempty-containers Data.Map.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")])
    

  8. keysSet :: NEMap k a -> NESet k

    nonempty-containers Data.Map.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])
    

  9. data NESet a

    nonempty-containers Data.Set.NonEmpty

    A non-empty (by construction) set of values a. At least one value exists in an NESet a at all times. Functions that take an NESet can safely operate on it with the assumption that it has at least one item. Functions that return an NESet provide an assurance that the result has at least one item. Data.Set.NonEmpty re-exports the API of Data.Set, faithfully reproducing asymptotics, typeclass constraints, and semantics. Functions that ensure that input and output sets are both non-empty (like insert) return NESet, but functions that might potentially return an empty map (like delete) return a Set instead. You can directly construct an NESet with the API from Data.Set.NonEmpty; it's more or less the same as constructing a normal Set, except you don't have access to empty. There are also a few ways to construct an NESet from a Set:

    1. The nonEmptySet smart constructor will convert a Set a into a Maybe (NESet a), returning Nothing if the original Set was empty.
    2. You can use the insertSet family of functions to insert a value into a Set to create a guaranteed NESet.
    3. You can use the IsNonEmpty and IsEmpty patterns to "pattern match" on a Set to reveal it as either containing a NESet or an empty map.
    4. withNonEmpty offers a continuation-based interface for deconstructing a Set and treating it as if it were an NESet.
    You can convert an NESet into a Set with toSet or IsNonEmpty, essentially "obscuring" the non-empty property from the type.

  10. insertSet :: Ord a => a -> Set a -> NESet a

    nonempty-containers Data.Set.NonEmpty

    O(log n). Convert a Set into an NESet 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.Set.fromList [5, 3]) == fromList (3 :| [4, 5])
    insertSet 4 Data.Set.empty == singleton 4 "c"
    

Page 125 of many | Previous | Next