Proposal #3339: Add (+>) as a synonym for mappend

Conor McBride conor at strictlypositive.org
Mon Aug 15 02:52:23 CEST 2011


On 14 Aug 2011, at 21:26, Brandon Allbery wrote:
>
> Speaking of which, has anyone formally proposed the class/instance  
> alias stuff for GHC?  If so, has anyone stepped in to implement it?   
> Having the tools to actually make this kind of change would be  
> helpful.

*ahem*

http://hackage.haskell.org/trac/ghc/wiki/DefaultSuperclassInstances

I don't know if it's likely to be implemented in GHC anytime soon,
but SHE has something rather like it (ie, it's so simple, a preprocessor
can do it).

A key motivation is exactly to minimise (but the minimum is not zero)
the damage done in the situation envisaged here. In particular, it
should be possible to add (<>) as a method to Monoid, then, at a later
date, split off Semigroup, taking (<>) with it, leaving existing Monoid
instances still valid (as they would implicity spawn Semigroup  
instances).

The nasty cases are when you want to define liftings where
Monoid x => Monoid (Lift x), but Semigroup x => Semigroup (Lift x).
The proposal as it stands would leave Monoid x => Semigroup (Lift x)
which might sometimes (but not all the time) be weaker than one has
the right to.

Other bits of class alias stuff (constraint synonyms) seem to be  
happening
round about now, somewhere in the vicinity of Cambridge.

So things are looking up. It should soon be technically feasible to
separate the issues of whether the Monoid operator should be (<>) and
whether it should actually live in a Semigroup superclass, pretty much
allowing neither, either or both-in-either-order adoption strategies.

Hoping this helps

Conor




More information about the Libraries mailing list