FW: Clarification of \begin{code} ... \end{code} stuff
Simon Peyton-Jones
simonpj@microsoft.com
Tue, 11 Dec 2001 01:15:17 -0800
> In the thread "Literate scripts not handled correctly" Simon Marlow
> said:
>=20
> > Yes, it looks like GHC's unlit program removes whitespace when=20
> > looking for \begin{code}, but not for \end{code}. The report isn't=20
> > explicit about whether whitespace is allowed on these lines, but I=20
> > would tend to the view that it isn't.
>=20
> Can you please clarify this in the report [...]
I'm sure the "\begin{code}" and "\end{code}" should
be at the beginning of a line. Whether anything else should be allowed
on that line is moot. Maybe not. What would the layout be for this?
\begin{code} f x =3D x
\end{code}
On the other hand it would be painful if a block of code was omitted
because
of a trailing space on the \begin{code} line; an easy error.
I therefore propose code starts on the line *following* a line beginning
with \begin{code}. And similarly stops on a line beginning \end{code}.
For Ian's snippet:
\begin{code}
foo =3D "hello\
\end{code}"
\end{code}
I think it's clear that the first \end{code} should be scanned as part
of the string literal.
Simon