
+1 to Andrew's original proposal. It is as old as lambda-calculus itself, and I do not know why anything else was ever implemented for Haskell. Agda got the parsing of \lambda right, and recently also the \forall. https://github.com/agda/agda/commit/7d84d57aad07b4fd452a4a62c91a5b83fe7e6020 --Andreas On 06.09.2015 00:55, Andrew Gibiansky wrote:
I'd like to propose a GHC extension called (for now) `ArgumentBody`. `ArgumentBody` is a simple syntax extension, than, when enabled, permits the following code:
main = whenTrue do putStrLn"Hello!"
main = forM values\value-> print value
main = forM values\case Just x-> print x Nothing -> print y
In this code we do not need `$` before `do`, lambda, or lambda-case (if -XLambdaCase is enabled). This change would /not/ extend to `let`, `if`, `case`, or any other constructs.
Pros:
1. Code is simpler and it greatly reduces the need for "operator line noise" of $ everywhere. 2. We can avoid using the type-checker hack for $ http://stackoverflow.com/questions/9468963/runst-and-function-composition for things such as runSt.
Cons:
1. Adds complexity to the compiler. (NB: The change is minimal and not invasive at all.) 2. Contributes to a proliferation of extensions that other tools must support. (NB: This is just a parser change so should be easy for all tools to support.)
I'm very interested in hearing both favoring and dissenting opinions on this proposed change. If this change is approved of, names besides -XArgumentBody can be considered.
See more info on Trac https://ghc.haskell.org/trac/ghc/ticket/10843#ticket.
-- Andrew Gibiansky
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-- Andreas Abel <>< Du bist der geliebte Mensch. Department of Computer Science and Engineering Chalmers and Gothenburg University, Sweden andreas.abel@gu.se http://www2.tcs.ifi.lmu.de/~abel/