PROPOSAL: Add instances to Data.Monoid newtype wrappers

Erik Hesselink hesselink at gmail.com
Thu Dec 11 20:44:15 UTC 2014


Since many of these are just the identity functor, should we just add
all class instances? So in addition to Functor, also add Foldable and
Traversable, and perhaps even Applicative, Monad, Alternative,
MonadPlus, MonadFix?

I'm +1 on the obviously useful instances (Data, Functor) and wouldn't
mind the others either, since I don't see any downsides.

Erik

On Thu, Dec 11, 2014 at 9:20 PM, Edward Kmett <ekmett at gmail.com> wrote:
> I'm a very strong +1 on this.
>
> We've already sat down to add some of these, and there was a general
> resolution by the core libraries committee in response to a similar raised
> issue for the types in GHC.Generics that missing instances like this that
> have obvious canonical implementations should be added wherever possible.
>
> -Edward
>
> On Fri, Dec 12, 2014 at 2:30 AM, Sean Leather <sean.leather at gmail.com>
> wrote:
>>
>> As of base 4.7.0.1, none of the newtype wrappers in Data.Monoid have
>> instances for:
>>
>> Typeable
>> Data
>> Functor
>>
>>
>> It looks like the base library repository has AutoDeriveTypeable, so I
>> presume that takes care of the Typeable instances. It also looks like First
>> and Last now have Functor instances, amongst others.
>>
>> In particular, I would like to add Functor instances for all parameterized
>> types, where applicable (i.e. Dual, Sum, Product).
>>
>> In general, I think we should add whatever other instances make sense.
>> Data came to mind. Others?
>>
>> Discussion period: 2 weeks (or perhaps until after the beginning of the
>> new year)
>>
>> Regards,
>> Sean
>>
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://www.haskell.org/mailman/listinfo/libraries
>>
>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>


More information about the Libraries mailing list