[Haskell-cafe] indentation with let and do

AlanKim Zimmerman alan.zimm
Thu Oct 3 18:43:24 UTC 2013


The first version has bar True and False all at the same indentation level.
As such they are seen as standalone expressions, rather than being nested
under the one introduced by bar.

See http://en.wikibooks.org/wiki/Haskell/Indentation




On Thu, Oct 3, 2013 at 8:31 PM, Corentin Dupont
<corentin.dupont at gmail.com>wrote:

> Hi the list,
> why do this function doesn't compile (parse error):
>
> test :: Bool -> IO ()
> test foo = do
>    let bar = case foo of
>        True ->  "Foo";
>        False -> "Bar"
>    return ()
>
> while this one does (just adding one space in front of True and False):
>
> test :: Bool -> IO ()
> test foo = do
>    let bar = case foo of
>         True ->  "Foo";
>         False -> "Bar"
>    return ()
>
>
> Thanks!!
> Corentin
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20131003/4564d734/attachment.htm>



More information about the Haskell-Cafe mailing list