Proposal: merge Data.Functor.Coproduct into transformers
Henning Thielemann
lemming at henning-thielemann.de
Tue Dec 11 22:26:32 CET 2012
On Tue, 11 Dec 2012, 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
>> change.
>>
>> 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.
>>
>> Perhaps
>>
>> data Coproduct f g a = LeftF (f a) | RightF (g a)
>>
>> would be a nice color for the bikeshed?
>
> Nah, those constructor names are dumb. I prefer Shaun's
>
>> data Sum f g a = SumLeft (f a) | SumRight (g a)
>
> If we're going with Sum, of course.
Please stop emulating qualification with custom prefixes or suffixes. We
have real qualification! (On the other hand you can throw in that
'transformers' is already designed for unqualified import.)
I find the analogies to algebraic sums and products appealing, thus I
would prefer Sum to Coproduct. But I would also be very happy with
Either(Left, Right) plus qualification.
More information about the Libraries
mailing list