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

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

2017-04-16 14:37 GMT+02:00 Vassil Ognyanov Keremidchiev
A small proposition for the next standard.
I think every proposal should clearly state the problem it is trying to solve first, because only after there's some agreement that it is actually a problem, further discussion is useful.
1) It is to lower verbosity with omitting 'let' keyword in do-notation and use only (=) for describing let/pure blocks. [...]
As has been discussed quite a few times on this and other Haskell-related lists, "verbosity" is a very subjective measure, and the number of characters to type is one of the worst metrics for evaluating the usefulness of a feature. In our example at hand, "let" is a very useful syntactic cue, and the visual difference between "x = foo" and "x <- foo" is a bit low IMHO. One can probably remove a lot of other syntactic stuff from Haskell and still keep it parsable by machines, but I think that's a non-goal. Remember that e.g. the entropy of English text is around 1 bit per character, but we don't speak binary, for a good reason. :-) 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.
I think the difference is there for a good reason: The desugaring rules are easy to comprehend. With your proposal things get complicated. Take e.g. a slightly modified version of your example (which can easily be complicated much more by alternating the different forms of bindings):
main = do z <- action x x = expression1 y y = expression2 z
putStrLn (x ++ y ++ z)
What is the meaning of this? And what problem exactly is this part of the proposal trying to solve?

1) It's not a problem, it's a improvement in syntax with lowering
verbosity. It's similar with the difference between Pascal and C syntax.
One of the reasons we all love Haskell is because it's not so verbose. I
have asked often why do-block is so different, than non-do-block.
Exchanging "x = foo" with "x <- foo" will result in error, so there is no
problem that the difference is small.
2) you're right. May be lazyness could solve that? I'm not sure here.
2017-04-16 18:10 GMT+03:00 Sven Panne
2017-04-16 14:37 GMT+02:00 Vassil Ognyanov Keremidchiev
: A small proposition for the next standard.
I think every proposal should clearly state the problem it is trying to solve first, because only after there's some agreement that it is actually a problem, further discussion is useful.
1) It is to lower verbosity with omitting 'let' keyword in do-notation and use only (=) for describing let/pure blocks. [...]
As has been discussed quite a few times on this and other Haskell-related lists, "verbosity" is a very subjective measure, and the number of characters to type is one of the worst metrics for evaluating the usefulness of a feature.
In our example at hand, "let" is a very useful syntactic cue, and the visual difference between "x = foo" and "x <- foo" is a bit low IMHO. One can probably remove a lot of other syntactic stuff from Haskell and still keep it parsable by machines, but I think that's a non-goal. Remember that e.g. the entropy of English text is around 1 bit per character, but we don't speak binary, for a good reason. :-)
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.
I think the difference is there for a good reason: The desugaring rules are easy to comprehend. With your proposal things get complicated. Take e.g. a slightly modified version of your example (which can easily be complicated much more by alternating the different forms of bindings):
main = do z <- action x x = expression1 y y = expression2 z
putStrLn (x ++ y ++ z)
What is the meaning of this? And what problem exactly is this part of the proposal trying to solve?

2017-04-16 17:21 GMT+02:00 Vassil Ognyanov Keremidchiev
1) It's not a problem, it's a improvement in syntax with lowering verbosity.
If it's not a real problem, it probably shouldn't be done: Every tiny change in the syntax, even if it's somehow backwards compatible, has a high cost in the whole ecosystem: The compiler has to be changed (probably by far the easiest part), libraries for parsing/pretty-printing Haskell have to be adapted, Editors/syntax highlighting rules have to be changed, books/tutorials have to be rewritten and people have to be retrained (yes, even if they don't use the new syntax: others might use it). To outweigh this pain, there should be be a real gain, saving just 4 keystrokes isn't worth it. And for me, and probably others, it's not an improvement in syntax, it actually makes things worse by removing a syntactic cue.
It's similar with the difference between Pascal and C syntax. One of the reasons we all love Haskell is because it's not so verbose.
I think it's actually not the non-verbosity which makes Haskell attractive, it's its expressiveness. These are two quite different things.
I have asked often why do-block is so different, than non-do-block.
Because it is fundamentally different from the rest, having a sequential nature (for some meaning of "sequential" given by the underlying monad).
Exchanging "x = foo" with "x <- foo" will result in error, so there is no problem that the difference is small.
Of course a machine will see the difference easily and immediately, the question is: Will people do so, too?
2) you're right. May be lazyness could solve that? I'm not sure here.
So what are the desugaring rules for your proposal? I have the gut feeling that they will be quite a bit more complicated and non-local than the current ones. Remember the famous quote: "If you can't explain it to a six year old, you don't understand it yourself." ;-)

Okay, sorry for taking your time about those propositions. I'm just
thinking of ways for improving future Haskell. My feedback is mostly from
talking with people and trying to teach them in Haskell.
2017-04-16 20:04 GMT+03:00 Sven Panne
2017-04-16 17:21 GMT+02:00 Vassil Ognyanov Keremidchiev
: 1) It's not a problem, it's a improvement in syntax with lowering verbosity.
If it's not a real problem, it probably shouldn't be done: Every tiny change in the syntax, even if it's somehow backwards compatible, has a high cost in the whole ecosystem: The compiler has to be changed (probably by far the easiest part), libraries for parsing/pretty-printing Haskell have to be adapted, Editors/syntax highlighting rules have to be changed, books/tutorials have to be rewritten and people have to be retrained (yes, even if they don't use the new syntax: others might use it). To outweigh this pain, there should be be a real gain, saving just 4 keystrokes isn't worth it. And for me, and probably others, it's not an improvement in syntax, it actually makes things worse by removing a syntactic cue.
It's similar with the difference between Pascal and C syntax. One of the reasons we all love Haskell is because it's not so verbose.
I think it's actually not the non-verbosity which makes Haskell attractive, it's its expressiveness. These are two quite different things.
I have asked often why do-block is so different, than non-do-block.
Because it is fundamentally different from the rest, having a sequential nature (for some meaning of "sequential" given by the underlying monad).
Exchanging "x = foo" with "x <- foo" will result in error, so there is no problem that the difference is small.
Of course a machine will see the difference easily and immediately, the question is: Will people do so, too?
2) you're right. May be lazyness could solve that? I'm not sure here.
So what are the desugaring rules for your proposal? I have the gut feeling that they will be quite a bit more complicated and non-local than the current ones. Remember the famous quote:
"If you can't explain it to a six year old, you don't understand it yourself."
;-)

On Sun, Apr 16, 2017 at 08:21:43PM +0300, Vassil Ognyanov Keremidchiev wrote:
Okay, sorry for taking your time about those propositions. I'm just thinking of ways for improving future Haskell. My feedback is mostly from talking with people and trying to teach them in Haskell.
As others, I am not convinced with the proposal (given the amount of boxes marked "Translation" in the Haskell report, I wish we had a standard way to handling syntactic rewrites; it could come handy in yours and many more cases). But I am interested in newcomers and their introduction to the language: did they get confused by `let` or just pointed it out as superfluous?

They are confused about when one should put "let x = ..." or "x <- ..."
mostly before they learn what is monad.
2017-04-16 21:15 GMT+03:00 Francesco Ariis
On Sun, Apr 16, 2017 at 08:21:43PM +0300, Vassil Ognyanov Keremidchiev wrote:
Okay, sorry for taking your time about those propositions. I'm just thinking of ways for improving future Haskell. My feedback is mostly from talking with people and trying to teach them in Haskell.
As others, I am not convinced with the proposal (given the amount of boxes marked "Translation" in the Haskell report, I wish we had a standard way to handling syntactic rewrites; it could come handy in yours and many more cases).
But I am interested in newcomers and their introduction to the language: did they get confused by `let` or just pointed it out as superfluous?
_______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime

I feel that if people are confused about whether to use "let x = ..."
or "x <- ...", changing the syntax to remove the "let" won't help.
On 16 April 2017 at 21:32, Vassil Ognyanov Keremidchiev
They are confused about when one should put "let x = ..." or "x <- ..." mostly before they learn what is monad.
2017-04-16 21:15 GMT+03:00 Francesco Ariis
: On Sun, Apr 16, 2017 at 08:21:43PM +0300, Vassil Ognyanov Keremidchiev wrote:
Okay, sorry for taking your time about those propositions. I'm just thinking of ways for improving future Haskell. My feedback is mostly from talking with people and trying to teach them in Haskell.
As others, I am not convinced with the proposal (given the amount of boxes marked "Translation" in the Haskell report, I wish we had a standard way to handling syntactic rewrites; it could come handy in yours and many more cases).
But I am interested in newcomers and their introduction to the language: did they get confused by `let` or just pointed it out as superfluous?
_______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime
_______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime
-- Michael Walker (http://www.barrucadu.co.uk)

Hi Vassil,
I just wanted to say that there is no need to apologize for making a
proposal!
Cheers,
Adam
On Mon, 17 Apr 2017 at 00:57 Michael Walker
I feel that if people are confused about whether to use "let x = ..." or "x <- ...", changing the syntax to remove the "let" won't help.
On 16 April 2017 at 21:32, Vassil Ognyanov Keremidchiev
wrote: They are confused about when one should put "let x = ..." or "x <- ..." mostly before they learn what is monad.
2017-04-16 21:15 GMT+03:00 Francesco Ariis
: On Sun, Apr 16, 2017 at 08:21:43PM +0300, Vassil Ognyanov Keremidchiev wrote:
Okay, sorry for taking your time about those propositions. I'm just thinking of ways for improving future Haskell. My feedback is mostly from talking with people and trying to teach them in Haskell.
As others, I am not convinced with the proposal (given the amount of boxes marked "Translation" in the Haskell report, I wish we had a standard way to handling syntactic rewrites; it could come handy in yours and many more cases).
But I am interested in newcomers and their introduction to the language: did they get confused by `let` or just pointed it out as superfluous?
_______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime
_______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime
-- Michael Walker (http://www.barrucadu.co.uk) _______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime

2017-04-17 14:19 GMT+02:00 Adam Bergmark
I just wanted to say that there is no need to apologize for making a proposal!
+1 for that, and sorry if I sounded harsh, that wasn't my intention. Proposals are important (we need more of them, not less), and so are discussions about them. Nothing would be worse than a dead language nobody cares about...

It's just helping clean up a bit words that doesn't have much meaning.
Currently GHCi in GHC 8 is supporting this, so you could write both:
x = 10
x <- return 10
Which is great!
2017-04-17 17:03 GMT+03:00 Sven Panne
2017-04-17 14:19 GMT+02:00 Adam Bergmark
: I just wanted to say that there is no need to apologize for making a proposal!
+1 for that, and sorry if I sounded harsh, that wasn't my intention. Proposals are important (we need more of them, not less), and so are discussions about them. Nothing would be worse than a dead language nobody cares about...

I like this proposition. I am not sure how to argue in favour as the measure is almost purely adressing an issue of esthetics. But I do like it, and I also find the comparison between C and Pascal relevant. I guess a patch or pull request will be the best way to move forward and shake some relevant problems out of the woodwork. Be known as the guy who removed let, go for it. :: Finn Espen Gundersen (fra mobil) ---- Sven Panne skrev ----
2017-04-16 14:37 GMT+02:00 Vassil Ognyanov Keremidchiev
: A small proposition for the next standard.
I think every proposal should clearly state the problem it is trying to solve first, because only after there's some agreement that it is actually a problem, further discussion is useful.
1) It is to lower verbosity with omitting 'let' keyword in do-notation and use only (=) for describing let/pure blocks. [...]
As has been discussed quite a few times on this and other Haskell-related lists, "verbosity" is a very subjective measure, and the number of characters to type is one of the worst metrics for evaluating the usefulness of a feature.
In our example at hand, "let" is a very useful syntactic cue, and the visual difference between "x = foo" and "x <- foo" is a bit low IMHO. One can probably remove a lot of other syntactic stuff from Haskell and still keep it parsable by machines, but I think that's a non-goal. Remember that e.g. the entropy of English text is around 1 bit per character, but we don't speak binary, for a good reason. :-)
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.
I think the difference is there for a good reason: The desugaring rules are easy to comprehend. With your proposal things get complicated. Take e.g. a slightly modified version of your example (which can easily be complicated much more by alternating the different forms of bindings):
main = do z <- action x x = expression1 y y = expression2 z
putStrLn (x ++ y ++ z)
What is the meaning of this? And what problem exactly is this part of the proposal trying to solve?
_______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime
participants (6)
-
Adam Bergmark
-
Finn Espen Gundersen
-
Francesco Ariis
-
Michael Walker
-
Sven Panne
-
Vassil Ognyanov Keremidchiev