0 | module Data.SortedSet.Extra
 1 |
 2 | import Data.SortedSet
 3 |
 4 | %default total
 5 |
 6 | -- Not really a functor's `map`, because map fusion law does not hold
 7 | export
 8 | mapIn : Ord b => (a -> b) -> SortedSet a -> SortedSet b
 9 | mapIn f = fromList . map f . Prelude.toList
10 |
11 | export
12 | mapInMaybe : Ord b => (a -> Maybe b) -> SortedSet a -> SortedSet b
13 | mapInMaybe f = fromList . mapMaybe f . Prelude.toList
14 |
15 | export
16 | fromFoldable : Ord a => Foldable f => f a -> SortedSet a
17 | fromFoldable = foldl insert' empty
18 |