This module defines a sequence where elements are always kept in order. This enables constant time access to the least and greatest elements, in addition to logarithmic time partitioning.
The module is intended to be imported qualified, to avoid ambiguity or name clashes. For example:
import Data.Sequence.Ordered (OrdSeq) import Data.Sequence.Ordered as OrdSeq
sort :: forall f a. Functor f => Foldable f => Unfoldable f => Ord a => f a -> f a
Sort any structure (which has Foldable, Unfoldable, and Functor instances) by converting to an OrdSeq and back again. I am fairly sure this is usually O(n*log(n)), although of course this depends on the Unfoldable and Foldable instances.