[Haskell-cafe] Names for pretty-printing combinators

Casey McCann syntaxglitch at gmail.com
Wed May 25 21:05:04 CEST 2011


One drastic approach I've used in personal libraries--operator-heavy EDSLs
specifically--is to define everything first with alphanumeric names, then
put operators in their own modules. In some cases I'd have three such
modules: One providing a minimal set of operators that don't clash with
anything significant, one providing a larger set of operators that clash
with one or more common modules (often deliberately, e.g. duplicating Arrow
combinators for some type with similar semantics but no valid Arrow
instance), and one providing a bunch of gratuitous Unicode operators that
look pretty in my code editor but I don't know how to type in GHCi.

I'm not sure if I've seen that approach anywhere else, however, so it might
not be something most people would care for.

- C.


On Wed, May 25, 2011 at 10:45 AM, Stephen Tetley
<stephen.tetley at gmail.com>wrote:

> Hi Ivan
>
> empty is fine as is, obviously with a Monoid instance as well, people
> can choose to use mempty which removes potential name clashes.
>
> I was thinking of (<$>) and (<+>), though I was forgetting that (<+>)
> is actually ArrowPlus.
>
> If you are mostly gifting angles as notation to Applicative, maybe a
> pretty print library can live with fewer infix ops? Though you could
> still define fixities for the binary cases:
>
> infixr 6 `sep1`
>
> Or maybe steal the notation form Vector-Space (^+^) as cases where you
> would want both imported at the same time may be uncommon.
>
> Although "trivial" proposals often get rejected for changes to Base, I
> suspect a proposal for (<>) as a synonym for `mappend` might have
> legs, it would certainly have a lot of support...
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110525/9e2586ea/attachment.htm>


More information about the Haskell-Cafe mailing list