Safe Haskell | Safe-Inferred |
---|---|

Language | Haskell2010 |

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. Import as:

import qualified RIO.Set.Unchecked as Set'

## 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 #

*O(n)*. The

, but works only when `mapMonotonic`

f s == `map`

f s`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 #

*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 #

*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 #

*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 #

*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.*