Proposal: Make Semigroup as a superclass of Monoid

Petr Pudlák petr.mvd at gmail.com
Fri Apr 10 14:47:04 UTC 2015


František Farka [1] worked in detail on a proposal that would make such
refactorings painless, see *Maintainable type classes for Haskell* [2]

  Cheers,
  Petr

[1] http://staff.computing.dundee.ac.uk/frantisekfarka/
[2] http://staff.computing.dundee.ac.uk/frantisekfarka/publications.html

po 30. 3. 2015 v 11:24 odesílatel Merijn Verstraaten <merijn at inconsistent.nl>
napsal:

> -2 from me.
>
> Not because I oppose Semigroup as a superclass of Monoid, but because of
> brittle migration path.
>
> I would much rather put the resurrection of DefaultSuperclassInstances
> [1], IntrinsicSuperclasses [2], or some new proposal on the roadmap that
> would allow us to more easily refactor and update the typeclass hierarchy
> without breaking everything all the time.
>
> Cheers,
> Merijn
>
> [1] - https://ghc.haskell.org/trac/ghc/wiki/DefaultSuperclassInstances
> [2] - https://ghc.haskell.org/trac/ghc/wiki/IntrinsicSuperclasses
> > On 30 Mar 2015, at 5:39, John Alfred Nathanael Chee <cheecheeo at gmail.com>
> wrote:
> >
> > Jeremy,
> >
> > Do you propose:
> >
> > Monoid a => Monoid (Maybe a)
> >
> > be changed to:
> >
> > Semigroup a => Monoid (Maybe a)
> >
> > as the documentation indicates?
> >
> > +1, but I think there are some technicalities that I think would benefit
> from a more concrete proposal including as a patch or hackage analysis.
> >
> > On Sun, Mar 29, 2015 at 8:16 PM, M Farkas-Dyck <strake888 at gmail.com>
> wrote:
> > On 29/03/2015 at 05:20:33 -0700, Jeremy wrote:
> > > 1. GHC 7.12 will include Semigroup and NonEmpty in base.
> >
> > +1 for Semigroup at least.
> >
> > NonEmpty is simply the cofree comonad of Maybe, so I think we ought to
> define it either as such or to be compatibly redefinitile as such, e.g.
> >
> > now:
> > data NonEmpty a = a .: Maybe (NonEmpty a)
> >
> > so potentially later:
> > data Cofree f a = a .: f (Cofree f a)
> > type NonEmpty = Cofree Maybe
> >
> > as otherwise we shall have various code using nonsame isomorphic types
> which one must convert or coerce between for no good reason.
> >
> > +1 for NonEmpty if so defined, -1 otherwise.
> >
> > > 2. GHC >7.12 will define Monoid as a subclass of Semigroup.
> >
> > +1
> >
> > On 29/03/2015 at 11:23:19 -0400, David Feuer wrote:
> > > I guess I should get a dog in the fight—I think <> should be the
> Semigroup method.
> >
> > +1
> > _______________________________________________
> > Libraries mailing list
> > Libraries at haskell.org
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
> >
> >
> >
> > --
> > Love in Jesus Christ, John Alfred Nathanael Chee
> > http://www.biblegateway.com/
> > http://web.cecs.pdx.edu/~chee/
> > _______________________________________________
> > Libraries mailing list
> > Libraries at haskell.org
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
> _______________________________________________
> 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/20150410/0c64b631/attachment.html>


More information about the Libraries mailing list