kosmikus/lhs2tex

Anonymous "_" argument not rendered consistently.

Opened this issue · 1 comments

The "_" that represents an anonymous argument is not converted consistently.

Here is the lhs input:

\documentclass{article}
%include polycode.fmt
\begin{document}

> t _ (0:_) = False

\end{document}

lhs2TeX converts the Haskell line as follows:
\>[3]{}\Varid{t}\;\anonymous \;(\mathrm{0}\mathbin{:\char95 })\mathrel{=}\Conid{False}{}\<[E]%
The first _ becomes \anonymous, the second one is \char95. They look different. How can I get a uniform appearance? I am using lhs2TeX version 1.19.

(In any case, \mathbin{:}\char95 would be more logical.)
ADDITION: Aha, it seems that lhs2TeX mistakenly takes :_ for a constructor symbol like :+ or ::>. Indeed, putting a space between : and _ is a workaround to solve this problem. The Haskell report defines which "symbol"s can be used to form an operator name.

Yes, this is one of the various peculiarities which are known (at least to me) for a long time, and I've never fixed them because I did not unnecessarily want to break backwards compatibility.

lhs2TeX is often being used for papers describing all sorts of variants of Haskell-like languages, so sometimes having a bit more syntactic flexibility than in standard Haskell is actually welcome.

It is also confusing though. And at the very least, it would be good if we had a documented list of known deviations.