library submission: Data.Either.unzipEithers :: [Either a b] -> ([a], [b])

Jeremy Shaw jeremy.shaw at linspireinc.com
Fri Sep 14 16:17:38 EDT 2007


Oops, just realized this is a dup:

http://hackage.haskell.org/trac/ghc/ticket/974

But, perhaps we can make some progress ?
j.

At Fri, 14 Sep 2007 13:12:41 -0700,
Jeremy Shaw wrote:
> 
> http://hackage.haskell.org/trac/ghc/ticket/1695
> 
> This function is like unzip for a list of Eithers instead of tuples.
> 
> According to google code search, I am at least the 5th person to
> implement this function:
> 
> http://www.google.com/codesearch?hl=en&lr=&q=%22%5BEither+a+b%5D+-%3E+%28%5Ba%5D%2C%5Bb%5D%29%22&btnG=Search
> 
> I opted for the name unzipEithers because the function is similar to
> two existing functions: unzip and catMaybes. It seems less similar to
> partition, because partition does not desconstruct the values, it just
> divides them into to two groups. I have no particular attachment to
> the name however.
> 
> I modeled the implementation after unzip and partition. Hopefully I
> made effective use of the irrefutable patterns and laziness, but
> someone else should verify.
> 
> j.
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries


More information about the Libraries mailing list