Proposal: merge Data.Functor.Coproduct into transformers

Henning Thielemann lemming at henning-thielemann.de
Sat Dec 15 22:24:48 CET 2012


On Sat, 15 Dec 2012, Gábor Lehel wrote:

> On Fri, Dec 14, 2012 at 9:50 PM, Bardur Arantsson <spam at scientician.net> wrote:
>> On 12/14/2012 08:37 PM, Mario Blažević wrote:
>>>     So far we have a consensus on the proposal (yay!), but no firm
>>> agreement on the naming.
>>
>> Throw some dice?
>
> Given that no one has tied their approval to a particular name, what
> about giving Ross Paterson, maintainer of transformers, the final
> vote?
>
> If I'm not missing one, the possibilities mentioned have been:
>
> newtype Coproduct f g a = Coproduct { getCoproduct :: Either (f a) (g a) }
> data Sum f g a = SumLeft (f a) | SumRight (g a)
> data Coproduct f g a = InL (f a) | InR (g a)
> data Sum f g a = InL (f a) | InR (g a)
> data Coproduct f g a = LeftF (f a) | RightF (g a)
> data EitherF f g a = LeftF (f a) | RightF (g a)
> data Either1 f g a = Left1 (f a) | Right1 (g a)


> data Either f g a = Left (f a) | Right (g a) -- import qualified

Since I proposed that and became aware of the newtype solution in the 
meantime, I change my mind to:

> data Sum f g a = Sum { getSum :: Either (f a) (g a) }


More information about the Libraries mailing list