Partitions a list of
Either into two lists. All the
Left
elements are extracted, in order, to the first component of the
output. Similarly the
Right elements are extracted to the
second component of the output.
Examples
Basic usage:
>>> let list = [ Left "foo", Right 3, Left "bar", Right 7, Left "baz" ]
>>> partitionEithers list
(["foo","bar","baz"],[3,7])
The pair returned by
partitionEithers x should be the
same pair as
(lefts x, rights x):
>>> let list = [ Left "foo", Right 3, Left "bar", Right 7, Left "baz" ]
>>> partitionEithers list == (lefts list, rights list)
True