RelaxedLayout language extensions should be default for Haskell

Axel Simon Axel.Simon at
Fri Jan 21 09:41:39 CET 2011


following the discussion on the ghc mailing list, I propose that the  
new "RelaxedLayout" extension that is proposed for ghc 7.1 should be  
incorporated into the language standard.

The motivation is that ghc <7.1 have silently implemented the  
"RelaxedLayout" by default and that removing this feature will break  
many programs without any gain except that ghc complies to the  
standard. Hence, it would be better that the standard is adjusted, as  
this would imply no changes to current ghc compilers nor user programs.

As I'm not familiar with the technical details, I can only give an  
idea about what "RelaxedLayout" does. Haskell 2010 would parse

foo = do
   some computation
   trace "hello" $ do
   other computation

such that "other computation" belongs to the first "do", i.e.

foo = do
   { some computation
   ; trace "hello" $ do
   ; other computation

which leads to a parse error since the second "do" not followed by any  
instructions. The relaxed layout extension opens a new block after a  
"do" if the next line commences on in the same column as the current  
block. Thus, it would parse the example above as:

foo = do
   { some computation
   ; trace "hello" $ do
   { other computation

- the proposal has been implemented in ghc for years
- it does not break any existing programs (as far as I can see)
- incorporating this proposal into the standard involves no  
implementation effort for the ghc compiler nor any program that  
compiles with ghc


More information about the Haskell-prime mailing list