rio-0.1.8.0: A standard library for Haskell

Safe Haskell | Safe
Language | Haskell2010

RIO.Set.Unchecked

Contents

- Map
- Ordered list

Description

This module contains functions from Data.Set that have unchecked preconditions on their input. If these preconditions are not satisfied, the data structure may end up in an invalid state and other operations may misbehave.

Synopsis

- mapMonotonic :: (a -> b) -> Set a -> Set b
- fromAscList :: Eq a => [a] -> Set a
- fromDescList :: Eq a => [a] -> Set a
- fromDistinctAscList :: [a] -> Set a
- fromDistinctDescList :: [a] -> Set a

# Map

mapMonotonic :: (a -> b) -> Set a -> Set b Source #

O(n). The

``mapMonotonic` f s == `map` f s`, but works only when `f` is strictly increasing. The precondition is not checked. Semi-formally, we have:

    and [x < y ==> f x < f y | x <- ls, y <- ls]
                        ==> mapMonotonic f s == map f s
        where ls = toList s

# Ordered list

fromAscList :: Eq a => [a] -> Set a Source #

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

fromDescList :: Eq a => [a] -> Set a Source #

O(n). Build a set from a descending list in linear time. The precondition (input list is descending) is not checked.

Since: containers-0.5.8

fromDistinctAscList :: [a] -> Set a Source #

O(n). Build a set from an ascending list of distinct elements in linear time. The precondition (input list is strictly ascending) is not checked.

fromDistinctDescList :: [a] -> Set a Source #

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