Simon Peyton Jones simonpj at
Fri Feb 9 09:24:21 UTC 2018

At very least the extension should be documented! Would you like to open a ticket for that?  And even offer a patch?

Thanks for pointing this out.


From: ghc-devs [mailto:ghc-devs-bounces at] On Behalf Of Harendra Kumar
Sent: 09 February 2018 02:43
To: Brandon Allbery <allbery.b at>
Cc: ghc-devs at Devs <ghc-devs at>
Subject: Re: DoAndIfThenElse

Since I started programming in Haskell a few years ago I have been using if-then-else in that manner without indentation and I never knew about this extension. I thought this is how it works. It seems this is the default now. But, I remember encountering an error in an older compiler version once and then I figured the my style was accepted in newer compiler versions only.


On 9 February 2018 at 08:08, Brandon Allbery <allbery.b at<mailto:allbery.b at>> wrote:
Huh. I wonder if a section went missing; seems like none of the extensions that alter or relax layout are documented currently. (AlternativeLayoutRule, AlternativeLayoutRuleTransitional, DoAndIfThenElse, NondecreasingIndentation, RelaxedLayout)

IIRC DoAndIfThenElse relaxes a condition implied by layout but that normally only matters in "do": that if you break it into multiple lines, the "then" and "else" must be indented farther than the "if" or layout will consider them distinct new expressions (and thereby syntax errors).

On Thu, Feb 8, 2018 at 9:24 PM, Harendra Kumar <harendra.kumar at<mailto:harendra.kumar at>> wrote:

I recently found a mention of DoAndIfThenElse extension somewhere. I looked inside the ghc user guide and could not find any such extension. Then I looked in the ghc man page, no mention. I googled and found a very sparse references to it here and there. Then I tried using the extension with ghc and ghc seems to accept it. What's the story behind this, why is it not documented but accepted?


ghc-devs mailing list
ghc-devs at<mailto:ghc-devs at><>

brandon s allbery kf8nh                               sine nomine associates
allbery.b at<mailto:allbery.b at>                                  ballbery at<mailto:ballbery at>
unix, openafs, kerberos, infrastructure, xmonad<>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list