
Are there other use cases where the left-associative operator enables nicer
code? I suspect that they are, but I can't think of any myself.
On Mon, Jun 6, 2016 at 6:45 AM, Mario Blažević
On 2016-06-06 07:30 AM, Herbert Valerio Riedel wrote:
Hello!
In short, the right-associative fixity of (Data.{Monoid,Semigroup}.<>) subtly conflicts with definitions of (<>) in pretty printing APIs, for which the left-associative variant is sometimes desirable. This subtle overloading of (<>) is error-prone, as one has to remember which version of (<>) is currently in scope in order to be able to reason about non-trivial expressions involving this operator.
This proposal is an attempt to resolve this unfortunate and confusing situation by completing the `Semigroup`/`Monoid` vocabulary with a standard left-associative alias. Please see
https://ghc.haskell.org/trac/ghc/wiki/Proposal/LeftAssocSemigroupOp
for more details.
Discussion period: 4 weeks
The proposal is well argued, but it omits any discussion of the proper place for the new operator. Why place it in Data.Semigroup, if its only purpose is to support the pretty-print libraries? Since the libraries in question will need to change anyway, or at least their imports will, why not add the operator there instead? Or, alternatively, to a Text.PrettyPrint module?
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries