- take :: [b] -> [a] -> [a]
- drop :: [b] -> [a] -> [a]
- splitAt :: [b] -> [a] -> ([a], [a])
- replicate :: [a] -> b -> [b]
- compareLength :: [a] -> [b] -> Ordering
- shorterList :: [a] -> [a] -> [a]

# Documentation

compareLength :: [a] -> [b] -> OrderingSource

Compare the length of two lists over different types.
It is equivalent to `(compare (length xs) (length ys))`

but more efficient.

shorterList :: [a] -> [a] -> [a]Source

Returns the shorter one of two lists.
It works also for infinite lists as much as possible.
E.g. `shortList (shorterList (repeat 1) (repeat 2)) [1,2,3]`

can be computed.
The trick is, that the skeleton of the resulting list
is constructed using `zipWith`

without touching the elements.
The contents is then computed (only) if requested.