Search code examples
haskellunicodehaddock

Use of unicode characters in Haddock documentation


Haddock seems to incorrectly re-encode non-ASCII characters in the documentation in UTF-8 encoded source files. I often need to include mathematical formulas in the documentation and they are much more readable if some common math symbols such as summation (∑) can be used.

However, after running the files through haddock, these symbols become blank squares. Haddock has the option --use-unicode but that just converts function arrows in function signatures etc. into unicode characters, while still breaking the actually documentation.

Even better would be if this can be controlled from cabal haddock!

I'm using Haddock version 2.9.4.


Solution

  • Note that Haddock uses the GHC API to do parsing. Non-ASCII characters in comments are not handled properly by GHC < 7.4, but it seems that with GHC 7.4 it works fine.