
6 Sep
2015
6 Sep
'15
8:53 a.m.
On Sat, Sep 05, 2015 at 03:55:37PM -0700, 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 = when True do putStrLn "Hello!"
main = forM values \value -> print value
main = forM values \case Just x -> print x Nothing -> print y
By the way, you can already do main = when True (do putStrLn "Hello!") main = forM values (\value -> print value) main = forM values (\case Just x -> print x Nothing -> print y) which gets you a lot of the way, and is arguably even clearer. This is as style that has been promoted by Chris Done. Tom