RelaxedLayout language extensions should be default for Haskell
Axel Simon
Axel.Simon at in.tum.de
Fri Jan 21 14:58:45 CET 2011
On 21.01.2011, at 09:41, Axel Simon wrote:
> Hi,
>
> 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.
>
Sorry, this should read "NondecreasingIndentation".
Axel
> 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
> }
> }
>
> Observations:
> - 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
>
> Cheers,
> Axel
>
>
> _______________________________________________
> Haskell-prime mailing list
> Haskell-prime at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-prime
More information about the Haskell-prime
mailing list