kosmikus / lhs2tex

Preprocessor for typesetting Haskell sources with LaTeX
Other
99 stars 28 forks source link

Anonymous "_" argument not rendered consistently. #50

Open guenterrote opened 7 years ago

guenterrote commented 7 years ago

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.

kosmikus commented 7 years ago

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.