Hoogle Search

Within LTS Haskell 24.6 (ghc-9.10.2)

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

  1. fromDistinctDescList :: NonEmpty (k, a) -> NEMap k a

    nonempty-containers Data.Map.NonEmpty

    O(n). Build a map from a descending list of distinct elements in linear time. The precondition is not checked.

    fromDistinctDescList ((5,"a") :| [(3,"b")]) == fromList ((3, "b") :| [(5, "a")])
    valid (fromDistinctDescList ((5,"a") :| [(3,"b")]))          == True
    valid (fromDistinctDescList ((5,"a") :| [(5,"b"), (3,"b")])) == False
    

  2. fromList :: Ord k => NonEmpty (k, a) -> NEMap k a

    nonempty-containers Data.Map.NonEmpty

    O(n*log n). Build a non-empty map from a non-empty list of key/value pairs. See also fromAscList. If the list contains more than one value for the same key, the last value for the key is retained.

    fromList ((5,"a") :| [(3,"b"), (5, "c")]) == fromList ((5,"c") :| [(3,"b")])
    fromList ((5,"c") :| [(3,"b"), (5, "a")]) == fromList ((5,"a") :| [(3,"b")])
    

  3. fromListWith :: Ord k => (a -> a -> a) -> NonEmpty (k, a) -> NEMap k a

    nonempty-containers Data.Map.NonEmpty

    O(n*log n). Build a map from a non-empty list of key/value pairs with a combining function. See also fromAscListWith.

    fromListWith (++) ((5,"a") :| [(5,"b"), (3,"b"), (3,"a"), (5,"a")]) == fromList ((3, "ab") :| [(5, "aba")])
    

  4. fromListWithKey :: Ord k => (k -> a -> a -> a) -> NonEmpty (k, a) -> NEMap k a

    nonempty-containers Data.Map.NonEmpty

    O(n*log n). Build a map from a non-empty list of key/value pairs with a combining function. See also fromAscListWithKey.

    let f k a1 a2 = (show k) ++ a1 ++ a2
    fromListWithKey f ((5,"a") :| [(5,"b"), (3,"b"), (3,"a"), (5,"a")]) == fromList ((3, "3ab") :| [(5, "5a5ba")])
    

  5. toAscList :: NEMap k a -> NonEmpty (k, a)

    nonempty-containers Data.Map.NonEmpty

    O(n). Convert the map to a list of key/value pairs where the keys are in ascending order.

    toAscList (fromList ((5,"a") :| [(3,"b")])) == ((3,"b") :| [(5,"a")])
    

  6. toDescList :: NEMap k a -> NonEmpty (k, a)

    nonempty-containers Data.Map.NonEmpty

    O(n). Convert the map to a list of key/value pairs where the keys are in descending order.

    toDescList (fromList ((5,"a") :| [(3,"b")])) == ((5,"a") :| [(3,"b")])
    

  7. toList :: NEMap k a -> NonEmpty (k, a)

    nonempty-containers Data.Map.NonEmpty

    O(n). Convert the map to a non-empty list of key/value pairs.

    toList (fromList ((5,"a") :| [(3,"b")])) == ((3,"b") :| [(5,"a")])
    

  8. fromList :: Ord k => NonEmpty (k, a) -> NEMap k a

    nonempty-containers Data.Map.NonEmpty.Internal

    O(n*log n). Build a non-empty map from a non-empty list of key/value pairs. See also fromAscList. If the list contains more than one value for the same key, the last value for the key is retained.

    fromList ((5,"a") :| [(3,"b"), (5, "c")]) == fromList ((5,"c") :| [(3,"b")])
    fromList ((5,"c") :| [(3,"b"), (5, "a")]) == fromList ((5,"a") :| [(3,"b")])
    

  9. toList :: NEMap k a -> NonEmpty (k, a)

    nonempty-containers Data.Map.NonEmpty.Internal

    O(n). Convert the map to a non-empty list of key/value pairs.

    toList (fromList ((5,"a") :| [(3,"b")])) == ((3,"b") :| [(5,"a")])
    

  10. fromList :: NonEmpty a -> NESeq a

    nonempty-containers Data.Sequence.NonEmpty

    Create a sequence from a finite list of elements. There is a function toNonEmpty in the opposite direction for all instances of the Foldable1 class, including NESeq.

Page 137 of many | Previous | Next