I'm having trouble with the listings package. I can't compile the following minimal example through pdfLaTeX:
\documentclass[a4paper, 11pt, twoside, openright, english]{memoir}
\usepackage{listings}
\newenvironment{haskellCode}
{%
\begin{lstlisting}%
}
{%
\end{lstlisting}%
}
\begin{document}
\begin{haskellCode}
test
\end{haskellCode}
\end{document}
The compilation process just stops and appears to ask me for input:
* <The hell? I'll just try pressing ENTER then...>
(Please type a command or say `\end')
*
But if I move the code in haskellCode directly into the document (i.e. use lstlisting directly) it compiles fine.
Any idea what's happening and how I can fix it?