[nhc-bugs] Re: Literate scripts not handled correctly

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Tue, 18 Sep 2001 12:29:15 +0100


> 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