3 ms·
You can easily shadow a name in a let binding in Haskell For example, let x = 5 in let x = 6 in putStrLn (show x) would print 6. Unless you turn on compiler
by tathougies 9y ago
You can easily shadow a name in a let binding in Haskell
For example,
let x = 5 in let x = 6 in putStrLn (show x)
would print 6. Unless you turn on compiler warnings, there is never a need to choose new names for variables if the old version is no longer needed.
- catnaroek 9y agoShadowing isn't the same thing as redefining. Try evaluating the following expression: let x = 4 ; f y = x + y in let x = 6 in f 10