
Aaron Denney wrote:
On 2006-11-13, roconnor@theorem.ca
wrote: On Mon, 13 Nov 2006, Bulat Ziganshin wrote:
i prefer name splitEithers. [...]
[...]
Unzip is reversible though. The order is preserved, and (uncurry zip) . unzip = id = unzip . (uncurry zip) There is no "zipEithers" that is any sort of reverse.
Only one-sided, of course: splitEithers . (\ (xs, ys) -> map Left xs ++ map Right ys) = id
Hmm. (,) is the generic product, and Either is the generic coproduct. counzip?
Or, better even, ``cozip'' ;-) (I couldn't resist...) (uncurry zip) :: ([a],[b]) -> [a * b] / / / / / / / / / / cozip :: [a + b] -> ([a],[b]) ;-) Wolfram P.S.: I currently have: eitherList :: [Either a b] -> ([a], [b]) eitherPair2 :: (a, Either b c) -> Either (a,b) (a,c) eitherMap :: (a -> c) -> (b -> d) -> Either a b -> Either c d