FW: Clarification of \begin{code} ... \end{code} stuff
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 [...]
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 = 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 = "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
participants (1)
-
Simon Peyton-Jones