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

2001-12-11 Thread Simon Peyton-Jones

 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


___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell



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

2001-12-10 Thread Ian Lynagh

On Mon, Dec 10, 2001 at 04:03:27PM +, 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


___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell