[Haskell-cafe] indentation with let and do

Corentin Dupont corentin.dupont
Thu Oct 3 19:46:00 UTC 2013


Thanks to all for your replies!
I asked the question because I often make this kind of transformations
(please don't mind the non-sensical example):

test :: Bool -> IO ()
test foo = do
   bar <- case foo of
      True ->  return "Foo"
      False -> return "Bar"
   return ()

into

test :: Bool -> IO ()
test foo = do
   let bar = case foo of
        True ->  "Foo"
        False -> "Bar"
   return ()

And was wondering why can't I maintain the initial (and nicer) indentation.
But since let allows for several bindings, it make sense...

Best,
Corentin




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

> test :: Bool -> IO ()
> test foo = do
>    let bar = case foo of
>        True ->  "Foo";
>        False -> "Bar"
>    return ()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20131003/41b6e773/attachment.htm>



More information about the Haskell-Cafe mailing list