Coping with multiple meanings of `<>`

Norman Ramsey nr at cs.tufts.edu
Tue Dec 14 19:23:35 UTC 2021


I find myself wanting to define instances of Semigroup (and Monoid)
in a file that also imports GHC.Utils.Outputable and its `<>` operation
on SDocs.  At the moment I am dealing with the incompatibility by
hiding the Outputable version and instead of writing `s1 <> s2` I write
`hcat [s1, s2]`.  This workaround seems ugly and vaguely embarrassing.

How are others dealing with this issue?  Would it be sensible simply
to make SDoc an instance of Semigroup (and Monoid), or would we be
concerned about potential additional overhead at compile time?


Norman


More information about the ghc-devs mailing list