[Haskell-cafe] Layout rule (was Re: PrefixMap: code reviewrequest)
Jared Updike
jupdike at gmail.com
Thu Mar 2 17:21:28 EST 2006
Layout only applies when something is less indented than previous
lines, I believe...
e.g.
> do
> c <- getContents "filename"
> putStrLn "blah"
or
> do
> x <- getContents "filename"
> putStrLn "ok"
works fine but
> do
> c <- blahAction
> putStrLn "blah"
obviously won't work
Jared.
On 3/2/06, Brian Hulley <brianh at metamilk.com> wrote:
> Brian Hulley wrote:
> [snip]
> > So any solutions welcome :-)
>
> Thank to everyone who replied to my queries about this whole layout issue.
>
> One other thing I've been wanting to ask (not to change! :-)) for a while
> is: how is the following acceptable according to the rules in the Haskell98
> report where "where" is one of the lexemes, which when followed by a line
> more indented than the line the layout-starting-lexeme is on, should start
> an implicit block:
>
> module M where
> data T = ..... -- not indented!
>
> According to my understanding of the layout algorithm, the above code would
> have to be written:
>
> module M where
> data T = ....
>
> Can anyone shed some light on what the formal rule is that allows the first
> (and very useful) way of laying out code to be ok?
>
> Thanks, Brian.
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
--
http://www.updike.org/~jared/
reverse ")-:"
More information about the Haskell-Cafe
mailing list