Re: instance {Semigroup, Monoid} (Bag a) ?

2021-04-14 Thread Ben Gamari
Richard Eisenberg writes: > Hi devs, > > In the work on simplifying the error-message infrastructure (heavy lifting by > Alfredo, in cc), I've been tempted (twice!) to add > >> instance Semigroup (Bag a) where >> (<>) = unionBags >> >> instance Monoid (Bag a) where >> mempty = emptyBag > >

Re: instance {Semigroup, Monoid} (Bag a) ?

2021-04-14 Thread Ben Gamari
Viktor Dukhovni writes: > On Wed, Apr 14, 2021 at 06:26:38PM +, Richard Eisenberg wrote: > >> In the work on simplifying the error-message infrastructure (heavy >> lifting by Alfredo, in cc), I've been tempted (twice!) to add >> >> > instance Semigroup (Bag a) where >> > (<>) = unionBags

Re: instance {Semigroup, Monoid} (Bag a) ?

2021-04-14 Thread chessai
+1 to add from me, seems sensible On Wed, Apr 14, 2021, 14:31 Viktor Dukhovni wrote: > On Wed, Apr 14, 2021 at 06:26:38PM +, Richard Eisenberg wrote: > > > In the work on simplifying the error-message infrastructure (heavy > > lifting by Alfredo, in cc), I've been tempted (twice!) to add >

Re: instance {Semigroup, Monoid} (Bag a) ?

2021-04-14 Thread Viktor Dukhovni
On Wed, Apr 14, 2021 at 06:26:38PM +, Richard Eisenberg wrote: > In the work on simplifying the error-message infrastructure (heavy > lifting by Alfredo, in cc), I've been tempted (twice!) to add > > > instance Semigroup (Bag a) where > > (<>) = unionBags > > > > instance Monoid (Bag a)

Re: instance {Semigroup, Monoid} (Bag a) ?

2021-04-14 Thread Sebastian Graf
Hi Richard, I've been guilty of slipping in similar instances myself. In fact, I like OrdList better than Bag precisely because it has more instances and thus a far better interface. Not being able to see whether mempty denotes a Bag should be as simple as a mouse hover with HLS set up. So a +99

Re: instance {Semigroup, Monoid} (Bag a) ?

2021-04-14 Thread Alan & Kim Zimmerman
I wonder if it would be possible to have an hlint rule to check for mempty instead of emptyBag. On Wed, 14 Apr 2021 at 19:27, Richard Eisenberg wrote: > Hi devs, > > In the work on simplifying the error-message infrastructure (heavy lifting > by Alfredo, in cc), I've been tempted (twice!) to

instance {Semigroup, Monoid} (Bag a) ?

2021-04-14 Thread Richard Eisenberg
Hi devs, In the work on simplifying the error-message infrastructure (heavy lifting by Alfredo, in cc), I've been tempted (twice!) to add > instance Semigroup (Bag a) where > (<>) = unionBags > > instance Monoid (Bag a) where > mempty = emptyBag to GHC.Data.Bag. The downside to writing