kosmikus / lhs2tex

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

Type applications #106

Open zenzike opened 1 month ago

zenzike commented 1 month ago

Type applications such as f @Int for some function f are a bit of a nuisance to work with; there's the obvious problem that @ needs to be escaped, but I am wondering if it would make sense for lhs2tex to work well with these automatically.

Unless I'm missing something, the current workaround is to make appropriate %format directives that elaborate to @ in Haskell, and print @ properly in tex.

kosmikus commented 1 month ago

Yes, I typically define

%if style == newcode
%format (TYAPP x) = "@" x
%else
%format (TYAPP x) = "\keyw{@}" x
%endif
zenzike commented 1 month ago

Thanks, I also used

%if style == newcode
%format (TLIST(x)) = "'[" x "]"
%else
%format (TLIST(x)) = " ^\prime\![" x "]"
%endif

to deal with type lists, which also caused problems.