Documentation
data T f a Source
The type T
can be used for many kinds of list-like structures
with restrictions on the size.
-
T [] a
is a lazy list containing at least one element.
-
T (T []) a
is a lazy list containing at least two elements.
-
T Vector a
is a vector with at least one element.
You may also use unboxed vectors but the first element will be stored in a box
and you will not be able to use many functions from this module.
-
T Maybe a
is a list that contains one or two elements.
-
T Empty a
is a list that contains exactly one element.
-
T (T Empty) a
is a list that contains exactly two elements.
Instances
(Monad f, Empty f, Cons f, Append f) => Monad (T f) | |
Functor f => Functor (T f) | |
(Functor (T f), Applicative f, Empty f, Cons f, Append f) => Applicative (T f) | |
Foldable f => Foldable (T f) | |
(Functor (T f), Foldable (T f), Traversable f) => Traversable (T f) | |
Sort f => Sort (T f) | |
Zip f => Zip (T f) | |
(Cons f, Append f) => Append (T f) | |
Empty f => Singleton (T f) | |
Cons f => Cons (T f) | |
(Eq a, Eq (f a)) => Eq (T f a) | |
(Eq (T f a), Ord a, Ord (f a)) => Ord (T f a) | |
(Show a, Show (f a)) => Show (T f a) | |
(Arbitrary a, Arbitrary f) => Arbitrary (T f a) | |
sortBy :: Sort f => (a -> a -> Ordering) -> T f a -> T f aSource
If you nest too many non-empty lists
then the efficient merge-sort (linear-logarithmic runtime)
will degenerate to an inefficient insert-sort (quadratic runtime).