Proposal: merge Data.Functor.Coproduct into transformers
wren ng thornton
wren at freegeek.org
Tue Dec 11 13:42:03 CET 2012
On 12/11/12 7:27 AM, Mario Blazevic wrote:
> On Tue, Dec 11, 2012 at 5:29 AM, Edward Kmett <ekmett at gmail.com> wrote:
>> I'm not wedded to its current behavior of wrapping an Either. It was kind of
>> nice that converting to and from Either was a no-op on GHC, but that could
>> I agree that I wouldn't want to add functions named 'left' and 'right', so
>> moving to a data type rather than a newtype seems reasonable.
>> data Coproduct f g a = LeftF (f a) | RightF (g a)
>> would be a nice color for the bikeshed?
I hesitate to suggest another alternative, but if folks are displeased
with those names, there's always the tried and true InL/InR or
InjL/InjR. But given the precedent of Either, I think LeftF/RightF have
a nice ring to them.
> Nah, those constructor names are dumb. I prefer Shaun's
>> data Sum f g a = SumLeft (f a) | SumRight (g a)
-1. What happened to the vaunted brevity? I type out the names of data
constructors far more often than the names of type constructors. And
those data constructor names are obnoxiously long for something as basic
as a functor coproduct.
More information about the Libraries