
#10843: Allow do blocks without dollar signs as arguments -------------------------------------+------------------------------------- Reporter: agibiansky | Owner: agibiansky Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: Phab:D1219 -------------------------------------+------------------------------------- Comment (by bgamari): I tried to count the +1s and -1s but it seems to be fairly evenly split. Moreover, it seems like many users are fairly ambivalent on the matter. Andrew's message from Sept 7 nicely reviews the various arguments for and against the proposal. I'll reproduce it and a few other notable points here, == Pro == - It's easier to read than the alternative. - This extension removes syntactic noise. - This makes basic `do`-syntax more approachable to newbies; it is a commonly asked question as to why the `$` is necessary. - This simplifies the resulting AST, potentially making it simpler for editors and other tools to do refactoring. - It's something that belongs in the main language, and if its something we'd consider for a mythical Haskell', it has to start as an extension. - It gets rid of some cases where using `$` doesn't work because `$` interacts with other infix operators being used in the same expression. - This would make do blocks consistent with record creation, where parentheses are skipped, allowing things such as `return R { x = y}` - This does not change the meaning of any old programs, only allows new ones that were previously forbidden. - This gets rid of the need for a specially-typed `$` allowing `runSt $ do ...` - Richard Eisenberg points out that the proposal arguably makes the language **more** consistent, not less, > I think that it makes the language *more* regular, not less: Look at https://www.haskell.org/onlinereport/haskell2010/haskellch3.html#x8-220003, the Haskell 2010 Report on expression syntax. This proposal (if we include `if`, `let`, and `case`, along with `\` and `do`, which would seem to make it more consistent) amounts to dropping the /lexp/ nonterminal and combining it with /aexp/. == Con == - It's harder to read than the alternative. - Creating a language extension to get rid of a single character is overkill and unnecessary. - You can already get rid of the `$` by just adding parentheses. - More and more syntactic "improvements" just fragment the language. - Although this is consistent with record syntax, record syntax without parents was a mistake originally. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10843#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler