[Haskell-cafe] if - then - else layout

Fraser Wilson blancolioni at gmail.com
Thu Sep 25 01:27:06 EDT 2008


I think you mean "in a do". There is a proposal to fix this in Haskell'

cheers,
Fraser

On Sep 25, 2008, at 6:59, "Brandon S. Allbery KF8NH" <allbery at ece.cmu.edu 
 > wrote:

> On 2008 Sep 25, at 0:47, leledumbo wrote:
>> consider this partial program:
>> if n>5 then
>> putStrLn "big"
>> else
>> putStrLn "small"
>>
>> this works fine in hugs, but in ghc I must change it to:
>> if n>5
>> then
>>   putStrLn "big"
>> else
>>   putStrLn "small"
>
>
> Actually, this also works:
>
>  if n > 5 then
>      putStrLn "big"
>    else
>      putStrLn "small"
>
> Except in a "do", the "else" must be indented beyond the start of  
> the "if".  I think Hugs is violating the Haskell98 layout rules.
>
> -- 
> brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
> system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
> electrical and computer engineering, carnegie mellon university     
> KF8NH
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe


More information about the Haskell-Cafe mailing list