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 15:21:39 UTC 2017


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 <svenpanne at gmail.com>:

> 2017-04-16 14:37 GMT+02:00 Vassil Ognyanov Keremidchiev <varosi at gmail.com>
> :
>
>> 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?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-prime/attachments/20170416/931bc9bd/attachment.html>


More information about the Haskell-prime mailing list