Hacker News new | past | comments | ask | show | jobs | submit login

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.




Shadowing 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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: