[Haskell-cafe] GHC Extension Proposal: ArgumentBlock
fumiexcel at gmail.com
Tue Sep 8 09:48:43 UTC 2015
It would be quite useful. It allows us to write
foo $!%$*~ runBarT do ...
(foo $!%$*~) $ runBarT $ do ...
2015-09-06 7:55 GMT+09:00 Andrew Gibiansky <andrew.gibiansky at gmail.com>:
> 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 = when True 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.
> 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 $
> for things such as runSt.
> 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
> -- Andrew Gibiansky
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe