Clarification of \begin{code} ... \end{code} stuff

Ian Lynagh igloo@earth.li
Mon, 10 Dec 2001 16:34:47 +0000


On Mon, Dec 10, 2001 at 04:03:27PM +0000, Ian Lynagh wrote:
> 
> In the thread "Literate scripts not handled correctly" Simon Marlow
> said:
> 
> > Yes, it looks like GHC's unlit program removes whitespace when looking
> > for \begin{code}, but not for \end{code}.  The report isn't explicit
> > about whether whitespace is allowed on these lines, but I would tend to
> > the view that it isn't.
> 
> Can you please clarify this in the report [...]

Here's an interesting snippet:

    \begin{code}

    foo = "hello\
    \end{code}"

    \end{code}

which nhc and hugs accept, GHC says "error in character literal".
I think this is a good reason for at least non-whitespace to not be
allowed on the \begin{code} and \end{code} lines (or rather, for lines
with other non-whitespace on them not to be treated as such).


Thanks
Ian