Haskell 2020: 'let' to be optional and with wider scope of visibility, like other Haskell functions

Vassil Ognyanov Keremidchiev varosi at gmail.com
Sun Apr 16 12:37:38 UTC 2017


Hello!

A small proposition for the next standard.
1) It is to lower verbosity with omitting 'let' keyword in do-notation and
use only (=) for describing let/pure blocks.
Example:

currently:

main = do
     let x = expression1...
     let y = expression2...
     z <- action1
     putStrLn (x ++ y ++ z)

It could be made less verbose currently with putting x and y in the same
'let' block:

main = do
     let x = expression1...
         y = expression2...
     z <- action1
     putStrLn (x ++ y ++ z)

But what if we use (=) for describing different expressions in do-block.

main = do
     x = expression1...
     y = expression2...
     z <- action1
     putStrLn (x ++ y ++ z)

So pure 'let' expressions to use (=) for assignment and monadic actions use
(<-) for execution/chaining. If 'let' is optional - this proposition will
be backward compatible.

2) Second proposition is every pure expression ('let') in do-block to have
visibility in whole block, just like top-level function is visible in whole
module. Currently there is difference in visibility depending on that if a
function is in do-block or is outside it.
Example:

main = do
     z <- action x
     x = expression1 y
     y = expression2

     putStrLn (x ++ y ++ z)

Best regards,
Vassil Keremidchiev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-prime/attachments/20170416/21fcffa6/attachment.html>


More information about the Haskell-prime mailing list