PROPOSAL: Add instances to Data.Monoid newtype wrappers

Herbert Valerio Riedel hvr at gnu.org
Sat Dec 13 10:03:41 UTC 2014


Hello Sean,

On 2014-12-11 at 16:30:53 +0100, Sean Leather 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. 

As a side-note: base-4.7 had AutoDeriveTypeable enabled as well for that
module, however, AutoDeriveTypeable is broken in GHC 7.8 (fails to
derive instances in most cases), only starting with GHC 7.10 it is
working properly.

> It also looks like First and Last now have Functor instances, amongst
> others.

Jfyi, here's a current documentation snapshot for the upcoming base-4.8:

https://hackage.haskell.org/package/base-4.8.0.0/candidate/docs/Data-Monoid.html

> 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?

Do you mind making a concrete list of which instances missing for each
newtype wrapper asap? That way we can already add them (assuming they
are all nobrainers) optimistically before GHC 7.10.1RC1 ships (and
should anything turn out to be problematic (which doesn't seem likely
given the current discussion progress) we can kill them again by RC2)

Cheers,
  hvr


More information about the Libraries mailing list