What is the reason for having a block letin do.
-- codeblock A
main = do
let a = 0
let f a = a + 1
let b = f 0
print (a,b)
-- codeblock B
main = do
a = 0
f a = a + 1
b = f 0
print (a,b)
Suppose all letwithout inmust be followed =(is that true?)
The compiler should be able to point letfrom =and preprocess / de-sugar codeblock Btocodeblock A
using letin this case seems unnecessary, for example, you can write codeblock C, but select a recordcodeblock D
-- codeblock C
main = do
print (a,b)
a = 0
f a = a + 1
b = f 0
-- codeblock D
main = do
print (a,b)
function a = 0
function f a = a + 1
function b = f 0
To clarify, my assumption does not include let, which follows in, which should remain untouched.
-- codeblock E
main = do
a = 0
f a = a + 1
b = f 0
c = let d = 1
e = 1
in d + e
print (a,b,c)
source
share