Hoogle Search

Within LTS Haskell 24.68 (ghc-9.10.3)

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

  1. isProperSubmapOf :: (Ord k, Eq a) => NEMap k a -> NEMap k a -> Bool

    nonempty-containers Data.Map.NonEmpty

    O(m*log(n/m + 1)), m <= n. Is this a proper submap? (ie. a submap but not equal). Defined as (isProperSubmapOf = isProperSubmapOfBy (==)).

  2. isProperSubmapOfBy :: Ord k => (a -> b -> Bool) -> NEMap k a -> NEMap k b -> Bool

    nonempty-containers Data.Map.NonEmpty

    O(m*log(n/m + 1)), m <= n. Is this a proper submap? (ie. a submap but not equal). The expression (isProperSubmapOfBy f m1 m2) returns True when m1 and m2 are not equal, all keys in m1 are in m2, and when f returns True when applied to their respective values. For example, the following expressions are all True:

    isProperSubmapOfBy (==) (singleton 1 1) (fromList ((1,1) :| [(2,2)]))
    isProperSubmapOfBy (<=) (singleton 1 1) (fromList ((1,1) :| [(2,2)]))
    
    But the following are all False:
    isProperSubmapOfBy (==) (fromList ((1,1) :| [(2,2)])) (fromList ((1,1) :| [(2,2)]))
    isProperSubmapOfBy (==) (fromList ((1,1) :| [(2,2)])) (singleton 1 1))
    isProperSubmapOfBy (<)  (singleton 1 1)               (fromList ((1,1) :| [(2,2)]))
    

  3. isSubmapOf :: (Ord k, Eq a) => NEMap k a -> NEMap k a -> Bool

    nonempty-containers Data.Map.NonEmpty

    O(m*log(n/m + 1)), m <= n. This function is defined as (isSubmapOf = isSubmapOfBy (==)).

  4. isSubmapOfBy :: Ord k => (a -> b -> Bool) -> NEMap k a -> NEMap k b -> Bool

    nonempty-containers Data.Map.NonEmpty

    O(m*log(n/m + 1)), m <= n. The expression (isSubmapOfBy f t1 t2) returns True if all keys in t1 are in tree t2, and when f returns True when applied to their respective values. For example, the following expressions are all True:

    isSubmapOfBy (==) (singleton 'a' 1) (fromList (('a',1) :| [('b',2)]))
    isSubmapOfBy (<=) (singleton 'a' 1) (fromList (('a',1) :| [('b',2)]))
    isSubmapOfBy (==) (fromList (('a',1) :| [('b',2)])) (fromList (('a',1) :| [('b',2)]))
    
    But the following are all False:
    isSubmapOfBy (==) (singleton 'a' 2) (fromList (('a',1) :| [('b',2)]))
    isSubmapOfBy (<)  (singleton 'a' 1) (fromList (('a',1) :| [('b',2)]))
    isSubmapOfBy (==) (fromList (('a',1) :| [('b',2)])) (singleton 'a' 1)
    

  5. nonEmptyMap :: Map k a -> Maybe (NEMap k a)

    nonempty-containers Data.Map.NonEmpty

    O(log n). Smart constructor for an NEMap from a Map. Returns Nothing if the Map was originally actually empty, and Just n with an NEMap, if the Map was not empty. nonEmptyMap and maybe empty toMap 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 Map being an NEMap.

    nonEmptyMap (Data.Map.fromList [(3,"a"), (5,"b")]) == Just (fromList ((3,"a") :| [(5,"b")]))
    

  6. toMap :: NEMap k a -> Map k a

    nonempty-containers Data.Map.NonEmpty

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

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

  7. unionMapLeft :: Ord k => Map k a -> NEMap k a -> NEMap k a

    nonempty-containers Data.Map.NonEmpty

    O(m*log(n/m + 1)), m <= n. Left-biased union of a possibly-empty Map and a non-empty map.

  8. unionMapRight :: Ord k => NEMap k a -> Map k a -> NEMap k a

    nonempty-containers Data.Map.NonEmpty

    O(m*log(n/m + 1)), m <= n. Left-biased union of a non-empty map and a possibly-empty Map.

  9. unionMapWithKeyLeft :: Ord k => (k -> a -> a -> a) -> Map k a -> NEMap k a -> NEMap k a

    nonempty-containers Data.Map.NonEmpty

    O(m*log(n/m + 1)), m <= n. Union of a possibly-empty Map and a non-empty map with a combining function, given the matching key.

  10. unionMapWithKeyRight :: Ord k => (k -> a -> a -> a) -> NEMap k a -> Map k a -> NEMap k a

    nonempty-containers Data.Map.NonEmpty

    O(m*log(n/m + 1)), m <= n. Union of a non-empty map and a possibly-empty Map with a combining function, given the matching key.

Page 959 of many | Previous | Next