
#11706: Increase precedence of lexps (if-then-else, case-of, do, lambda and let-in) -------------------------------------+------------------------------------- Reporter: YoYoYonnY | Owner: Type: feature request | Status: infoneeded Priority: lowest | Milestone: ⊥ Component: Compiler | Version: (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by YoYoYonnY: @@ -16,1 +16,1 @@ - Basically, these are the rule Haskell already uses. + Basically, these are the rules Haskell already uses. @@ -30,3 +30,3 @@ - [https://ghc.haskell.org/trac/ghc/ticket/10843#comment:12 in this - comment]); combining {{{lexp}}} with {{{aexp}}} would make the Haskell - syntax more consistent. + [https://ghc.haskell.org/trac/ghc/ticket/10843#comment:12 this comment]); + combining {{{lexp}}} with {{{aexp}}} would make the Haskell syntax more + consistent. @@ -71,0 +71,1 @@ + @@ -72,0 +73,1 @@ + @@ -74,0 +76,1 @@ + New description: == Intro == For readability, the intro is now available [http://pastebin.com/8Fsh7pAE here]. == How it works == * Implicit parenthesis will be put around ''all'' {{{lexps}}}, according to the following rules: 1. Parenthesis will be opened at the start of the {{{lexp}}}. 2. Parenthesis will be closed at the end of the {{{lexp}}}. The end of the {{{lexp}}} is determined by 1. The curly brackets around the {{{lexp}}} (If possible), or; 2. The indentation of the {{{lexp}}} Basically, these are the rules Haskell already uses. As for the Context-Free Syntax found at https://www.haskell.org/onlinereport/haskell2010/haskellch10.html#x17-17800010.3|layout, {{{lexp}}} would have to be moved up, dropped out of {{{infixexp}}}, and added into {{{exp}}} (As well as a few other places in {{{aexp}}} and {{{guard}}}) == Motivation == As for my personal motivation, I think that, with all the other syntactic extensions already implemented, this feature is definitly missing. As Richard Eisenberg already pointed out (See [https://ghc.haskell.org/trac/ghc/ticket/10843#comment:12 this comment]); combining {{{lexp}}} with {{{aexp}}} would make the Haskell syntax more consistent. bgamari listed above argument and quite a few other pros and cons [https://ghc.haskell.org/trac/ghc/ticket/10843#comment:12 here]. A few arguments not listed there: * If the Haskell community ever decides to implement this feature in the main language, we will already be prepared. * Similairly, if this feature ever gives problems or adds new interesting possibilities to the language, we will be prepared. * Yet another syntactical extension means yet another thing to look out for; * However, this also means people will become more aware of LANGUAGE pragmas. == Naming == Here follow a few suggestions for the name of this extension: * InlineStatements * InfixStatements * ParenthesizedStatements * IncreasedStatementPrecedence * StatementsWithoutParenthesis Here are some more, taken from [https://mail.haskell.org/pipermail /haskell-cafe/2015-September/121217.html over here]. * ArgumentBlock * ArgumentDo == Examples == Examples can now be found [http://pastebin.com/6kLQvKs9 here]. == Resources == [1] Cheesy intro: http://pastebin.com/8Fsh7pAE [2] Original examples: [http://pastebin.com/6kLQvKs9] [3] Pros and Cons: [https://ghc.haskell.org/trac/ghc/ticket/10843#comment:12] [4] ArgumentBlock proposal: [https://mail.haskell.org/pipermail/haskell- cafe/2015-September/121217.html] -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11706#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler