PROPOSAL: Add Map/IntMap newtypes for different Monoid to containers

Edward Kmett ekmett at gmail.com
Fri Mar 24 19:35:46 UTC 2017


If you have to choose between the two use Ben's code, reducers is in
hospice on life-support, and is unlikely to see anything more than a
maintenance release in the foreseeable future.

-Edward

On Fri, Mar 24, 2017 at 1:34 PM, Ben Gamari <ben at smart-cactus.org> wrote:

> Merijn Verstraaten <merijn at inconsistent.nl> writes:
>
> > I would like to propose adding a newtype wrapper (with all relevant
> > instances) for Map and IntMap (if I missed any other applicable type
> > in containers, let me know).
> >
> > This newtype should differ in Monoid/Semigroup instance from Map/IntMap
> by switching:
> >
> > Ord k => Semigroup (Map k v)
> > Ord k => Monoid (Map k v)
> >
> > to:
> >
> > (Ord k, Semigroup v) => Semigroup (Map k v)
> > (Ord k, Monoid v) => Monoid (Map k v) or (Ord k, Semigroup v) => Monoid
> (Map k v)
> >
> > Any opinions on the overall idea? Opinions on which Monoid instance?
> > Bikeshed for the newtype names?
> >
> For what it's worth, I provide precisely this in my monoidal-containers
> package [1]. Also, Edward Kmett provides a similar idea in his reducers
> package [2].
>
> Cheers,
>
> - Ben
>
>
> [1] https://hackage.haskell.org/package/monoidal-containers
> [2] https://hackage.haskell.org/package/reducers-3.12.1/docs/
> Data-Semigroup-Union.html
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20170324/a55ab53f/attachment.html>


More information about the Libraries mailing list