[ base ] Data.SortedSet.leftMost and .rightMost (#3260)

* [ base ] Data.SortedSet.leftMost and .rightMost

Implement `leftMost` and `rightMost` for `SortedSet` in terms of the
functions with the same name in `Data.SortedMap`.

* contributors

---------

Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>
This commit is contained in:
MithicSpirit 2024-06-05 07:00:57 -04:00 committed by GitHub
parent 40d4cd898b
commit f83ad9ce98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 0 deletions

View File

@ -139,6 +139,8 @@ This CHANGELOG describes the merged but unreleased changes. Please see [CHANGELO
* Removed need for the runtime value of the implicit argument in `succNotLTEpred`.
* Implemented `leftMost` and `rightMost` for `SortedSet`.
* Added `funExt0` and `funExt1`, functions analogous to `funExt` but for functions
with quantities 0 and 1 respectively.

View File

@ -57,6 +57,7 @@ Nicolas Biri
Niklas Larsson
Ohad Kammar
Peter Hajdu
Ricardo Prado Cunha
Robert Walter
rhiannon morris
Rodrigo Oliveira

View File

@ -62,6 +62,16 @@ export
intersection : (x, y : SortedSet k) -> SortedSet k
intersection x y = difference x (difference x y)
||| Returns the leftmost (least) value
export
leftMost : SortedSet k -> Maybe k
leftMost (SetWrapper m) = fst <$> leftMost m
||| Returns the rightmost (greatest) value
export
rightMost : SortedSet k -> Maybe k
rightMost (SetWrapper m) = fst <$> rightMost m
export
Ord k => Semigroup (SortedSet k) where
(<+>) = union