[Haskell-cafe] Hackage bug? Autobuild failure on literate source with ignored code blocks.

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Mon Sep 28 14:08:08 EDT 2009


On Sep 28, 2009, at 12:21 , Duncan Coutts wrote:
> On Sun, 2009-09-27 at 21:06 +0100, John Millikin wrote:
>> According to <http://www.haskell.org/haskellwiki/ 
>> Literate_programming>,
>> the following should compile properly because the second block of  
>> code
>> will be ignored by GHC:
>>
>> \begin{code}
>> main = putStrLn "Hello world!"
>> \end{code}
>>
>> \begin{code}%
>> main = -- TODO
>> \end{code}%
>
> It looks to me like the advice on that wiki page is incorrect.
>
> The Haskell98 report states:
>
>        An alternative style of literate programming is particularly
>        suitable for use with the LaTeX text processing system. In this
>        convention, only those parts of the literate program that are
>        entirely enclosed between \begin{code}...\end{code} delimiters
>        are treated as program text; all other lines are comment. More
>        precisely:
>
>              * Program code begins on the first line following a line
>                that begins \begin{code}.
>              * Program code ends just before a subsequent line that
>                begins \end{code} (ignoring string literals, of  
> course).
>
> The key phrases is "a line that begins \begin{code}". In other  
> words, a
> line "\begin{code}%" does indeed begin a code block.


Isn't the better solution to this something like
\let\uncode\code
\let\enduncode\endcode

then use \begin{uncode} .. \end{uncode} ?

(depends on how the code environment is defined)

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090928/da6c8fa8/PGP.bin


More information about the Haskell-Cafe mailing list