[Haskell-cafe] Layout rules for if then else
Vo Minh Thu
noteed at gmail.com
Tue Mar 10 16:04:11 UTC 2015
What you state is true within a `do` expression. What you wrote is a
single if_then_else_ expression on the rhs of the function definition.
Cheers,
Thu
2015-03-10 17:01 GMT+01:00 Alan & Kim Zimmerman <alan.zimm at gmail.com>:
> I am working on ghc-exactprint, and need to flag points where layout must be
> preserved, and considering the `if` statement.
>
> My understanding of the layout rules for if then else is that the `then` has
> to start more to the right than the `if`.
>
> Using GHC 7.10 RC2, ghci cheerfully loads the following
>
> ```
> f =
> if True
> then 1
> else 2
>
> ```
>
> Is this valid? Have the rules been relaxed?
>
> Alan
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
More information about the Haskell-Cafe
mailing list