[Haskell-cafe] Haddock - How to write formulas ?

Mateusz Kowalczyk fuuzetsu at fuuzetsu.co.uk
Mon Jan 6 22:20:01 UTC 2014

On 06/01/14 18:49, Peter Caspers wrote:
> Hi,
> I am still very new to Haskell, trying to start my very first project.
> For its documentation I want to use Haddock and suitable comments in
> the source code.
> I notice that (e.g. different from doxygen) there is no direct way of
> writing formulas, say in TeX style. Looking into some projects on
> Hackage, formulas there
> seem to be written in "pseudo-code" more or less like TeX but not
> following any strict standard. As far as I can see.

That's right, there's no direct way to embed maths in Haddock. It has
been a somewhat requested feature for Haddock over summer when I did
work on it but it didn't make it in.

> What would be your recommendations concerning this ? Is there some
> guideline on how to include formulas ? I understand that there is
> "literal programming"
> where you can e.g. write a TeX article with embedded code blocks that
> can be extracted for the compiler. However, I do not want to follow
> this path, also the
> result is a bit different from what is produced in the "traditional"
> approach, isn't it.

If you want manually-written LaTeX, this is probably the only way at the
moment. If all you want is some LaTeX snippets (maths), your best bet is
to probably write those separately, make images out of them and then
embed them into your documentation. There's currently no way for Haddock
to do this for you. We do however have a LaTeX back-end so it's not like
it's impossible to generate but it'd require some work that has not yet
been put in.

> Thanks a lot
> Peter
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

Mateusz K.

More information about the Haskell-Cafe mailing list