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?


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


This produces


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


I don't agree that [u]sually, the list concatenation operator in Haskell is printed as overlapping double plus signs in books, instead most manuscripts about Haskell prefer to use ASCII (sometimes monotype, sometimes with additional highlighting) for representing Haskell operations. The exceptions are generally authors concerned with equational reasoning in Haskell, influenced by the Bird-Meertens formalism.

The issue, I think, is that Haskell has a lot of multi-character, non-alphabetical infix operators. The Haskell 98 Report has !!, ^^, **, ==, /=, <=, >=, &&, ||, >>, >>=, and $!, of which only a few obviously correspond to a glyph. Making up your own risks confusion: even the relatively obvious-seeming map of == to ≡ does confuse. Losing the property of mapping your pretty-printed code to something you can type in is a very serious problem in a Haskell paper. The issue is less serious in a book-length treatment, but it is still there. So I recommend using a package like minted.

If you really do want to represent "++", I find Caramdir's solution puts the two vertical lines too close together. Gibbons (1994), An Introduction to the Bird-Meertens Formalism place the lines a little wider apart, but even wider, where each segment of the trisected line is equal, looks more attractive still to my eyes:

\def\drawplusplus#1#2#3{\hbox to 0pt{\hbox to #1{\hfill\vrule height #3 depth
      0pt width #2\hfill\vrule height #3 depth 0pt width #2\hfill
      }}\vbox to #3{\vfill\hrule height #2 depth 0pt width
      #1 \vfill}}
      %Poor man's typography
\def\concat{\mathrel{\drawplusplus {12pt}{0.4pt}{5pt}}}
      %It would be better to specify these in font-relative measures, but it 
      %probably doesn't scale anyway.
\[x = y \concat z\]

These might be a bit obvious, but the -> is nice as → (U+2192 RIGHTWARDS ARROW), => as ⇒ (U+21D2 RIGHTWARDS DOUBLE ARROW), and <- as ← (U+2190 LEFTWARDS ARROW).

I felt that Programming in Haskell by Graham Hutton was nicely put together. You can find an example of it from here: http://www.cs.nott.ac.uk/~gmh/solutions.pdf Maybe it can give you some ideas.

There is also lhs2TeX, but I found its output to be rather bloated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.