Hoogle Search

Within LTS Haskell 24.61 (ghc-9.10.3)

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

  1. fromNonEmptyList :: IsNonEmptyList nes => NonEmpty (Item nes) -> nes

    nonempty-containers Data.Containers.NonEmpty.List

    No documentation available.

  2. toNonEmptyList :: IsNonEmptyList nes => nes -> NonEmpty (Item nes)

    nonempty-containers Data.Containers.NonEmpty.List

    No documentation available.

  3. fromAscList :: NonEmpty (Key, a) -> NEIntMap a

    nonempty-containers Data.IntMap.NonEmpty

    O(n). Build a map from an ascending non-empty list in linear time. The precondition (input list is ascending) is not checked.

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

  4. fromAscListWith :: (a -> a -> a) -> NonEmpty (Key, a) -> NEIntMap a

    nonempty-containers Data.IntMap.NonEmpty

    O(n). Build a map from an ascending non-empty list in linear time with a combining function for equal keys. /The precondition (input list is ascending) is not checked./

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

  5. fromAscListWithKey :: (Key -> a -> a -> a) -> NonEmpty (Key, a) -> NEIntMap a

    nonempty-containers Data.IntMap.NonEmpty

    O(n). Build a map from an ascending non-empty list in linear time with a combining function for equal keys. /The precondition (input list is ascending) is not checked./

    let f k a1 a2 = (show k) ++ ":" ++ a1 ++ a2
    fromAscListWithKey f ((3,"b") :| [(5,"a"), (5,"b"), (5,"b")]) == fromList ((3, "b") :| [(5, "5:b5:ba")])
    valid (fromAscListWithKey f ((3,"b") :| [(5,"a"), (5,"b"), (5,"b")])) == True
    valid (fromAscListWithKey f ((5,"a") :| [(3,"b"), (5,"b"), (5,"b")])) == False
    

  6. fromDistinctAscList :: NonEmpty (Key, a) -> NEIntMap a

    nonempty-containers Data.IntMap.NonEmpty

    O(n). Build a map from an ascending non-empty list of distinct elements in linear time. The precondition is not checked.

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

  7. fromList :: NonEmpty (Key, a) -> NEIntMap a

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

  8. fromListWith :: (a -> a -> a) -> NonEmpty (Key, a) -> NEIntMap a

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

  9. fromListWithKey :: (Key -> a -> a -> a) -> NonEmpty (Key, a) -> NEIntMap a

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

  10. toAscList :: NEIntMap a -> NonEmpty (Key, a)

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

Page 135 of many | Previous | Next