unzip package:base

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")
Generalization of Data.List.unzip.

Examples

>>> unzip (Just ("Hello", "World"))
(Just "Hello",Just "World")
>>> unzip [("I", "love"), ("really", "haskell")]
(["I","really"],["love","haskell"])
Warning: This function will be made monomorphic in base-4.22, consider switching to Data.Functor.unzip
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 unzip4 function takes a list of quadruples and returns four lists, analogous to unzip.
The unzip5 function takes a list of five-tuples and returns five lists, analogous to unzip.
The unzip6 function takes a list of six-tuples and returns six lists, analogous to unzip.
The unzip7 function takes a list of seven-tuples and returns seven lists, analogous to unzip.
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.