Proposal: merge Data.Functor.Coproduct into transformers

Gábor Lehel illissius at gmail.com
Tue Dec 11 13:48:44 CET 2012


On Tue, Dec 11, 2012 at 1:42 PM, wren ng thornton <wren at freegeek.org> wrote:
> 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
>>> 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?
>
>
> +1.
>
> 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.
>

Another possibility is

data EitherF f g a = LeftF (f a) | RightF (g a)

But +1 to the proposal no matter the names, +1 to LeftF/RightF, +0 to
any particular type name (including this one).

-- 
Your ship was destroyed in a monadic eruption.



More information about the Libraries mailing list