# lhs2TeX and Syntax conflicting on <> characters

I'd like to use Syntax and lhs2TeX together, but Syntax's usage of <> in production rule names seems to conflict with lhs2TeX:

\documentclass{article}
\usepackage[nounderscore]{syntax}

%include lhs2TeX.fmt

\begin{document}
\begin{grammar}
<foo> ::= <bar>
\end{grammar}
\end{document}


if I try to typeset this:

$lhs2TeX a.lhs -o a.tex$ pdflatex a.tex


I get

! Use of \gr@implitem doesn't match its definition.
\leftskip\mathindent\(


Is there a way to use these two packages together?

Leading < characters are interpreted by lhs2TeX as shorthand for the spec environment (i.e. literate Haskell that should not be picked up by the compiler), as explained in chapter 3 of its usage guide. I was able to work around this by simply adding a leading space before the < on the production rule's left-hand side:

\documentclass{article}
\usepackage[nounderscore]{syntax}

%include lhs2TeX.fmt

\begin{document}
\begin{grammar}
<foo> ::= <bar>
\end{grammar}
\end{document}


This version is processed by lhs2TeX and pdflatex as expected.