Last generator in do {...}

Mark Carroll mark@chaos.x-philes.com
Wed, 30 Oct 2002 09:09:05 -0500 (EST)


On Wed, 30 Oct 2002, Andrew J Bromage wrote:
(snip)
> 	main = do foo <- bar
>                 return foo
>                 ^ offside error, Haskell interprets this as not being
>                   part of the do expression

Gosh, I find that unintuitive, given, say,
http://www.zvon.org/other/haskell/Outputsyntax/doQexpressions_reference.html
- though I'd also been surprised to not be able to get away with,

   let square = x
      ellipse = y
   in
      ...

so clearly the offside rule is still capable of confusing me. I should go
re-read a FAQ perhaps! (-:

-- Mark