Literate scripts not handled correctly

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Tue Sep 18 07:29:15 EDT 2001


> My understanding is that the following script:
> 
> ----- cut here -----
> 
> > foo :: Int -> Int
> > foo _ = 2
> 
> \begin{code}
> 
> bar :: Int -> Int
> bar _ = 1
> 
> \end{code}
> 
> ----- cut here -----
> 
> should be valid and define foo and bar (although the report does say "It
> is not advisable to mix these two styles in the same file").

The definitions of foo and bar are not at the same indentation level,
so they are being rejected by the layout rule.  At least, hugs and
nhc98 accept it if you indent bar by two spaces, ghc still complains:

  ghc -c lit.lhs
  lit.lhs:9: parse error on input `_'


Regards,
    Malcolm




More information about the Glasgow-haskell-bugs mailing list