Often you hear that to declare a function in GHCi, you have to precede it with “let” – this is to “let” the interpreter know that you are giving it a declaration, rather than a statement.
Well, last night, I did the unthinkable. I forgot the leading ‘let’… gasp!
Fortunately, GHCi forgave me. It turns out you do not need ‘let’ anymore when declaring functions in GHCi. You can use it, but it’s not strictly necessary. See this page for more information: https://phabricator.haskell.org/D1299
The essence is that GHCi will try to parse the input string as a statement, and if successful, it will run it as a statement. Otherwise, it will run it as a declaration.
GHCi said, “‘Let’ there be functions!” And so it came to be.
But Haskellers cried and gnashed their teeth, beseeching GHCi,”Oh great one, can you not tell when there be declarations, and when there be statements?”
And so GHCi realized how the parser could be used to determine the difference automatically, and struck down this let-down! And the Haskellers agreed that it was good.
“Let” me know if the Biblical humor gets annoying… Actually don’t – I can already tell…