unzip package:relude

unzip transforms a list of pairs into a list of first components and a list of second components.

Examples

>>> unzip []
([],[])
>>> unzip [(1, 'a'), (2, 'b')]
([1,2],"ab")
The unzip3 function takes a list of triples and returns three lists of the respective components, analogous to unzip.

Examples

>>> unzip3 []
([],[],[])
>>> unzip3 [(1, 'a', True), (2, 'b', False)]
([1,2],"ab",[True,False])
The mapAndUnzipM function maps its first argument over a list, returning the result as a pair of lists. This function is mainly used with complicated data structures or a state monad.