[Tex/LaTex] How to typeset Haskell ++ operator and friends

literate-programmingsymbols

Usually, the list concatenation operator in Haskell is printed as overlapping double plus signs in books.

(In ASCII it is just ++)

How can I typeset this sign in Haskell (in and perhaps outside of math mode)?

What are other Haskell operators which could be typeset more beautiful in LaTeX?

Best Answer

I couldn’t find the symbol in symbols, but it is easy enough to define:

\newcommand\doubleplus{+\kern-1.3ex+\kern0.8ex}
\newcommand\mdoubleplus{\ensuremath{\mathbin{+\mkern-10mu+}}}

This produces

example

If you use xelatex or lualatex with unicode-math, you can just write ⧺ (U+29FA DOUBLE PLUS) or its alias \doubleplus. This gives (with XITS fonts)

example with xits