I am new to Haskell and I am very confused by Where vs. Let. They both seem to provide a similar purpose. I have read a few comparisons bet
I found this example from LYHFGG helpful:
ghci> 4 * (let a = 9 in a + 1) + 2
42
let
is an expression so you can put a let
anywhere(!) where expressions can go.
In other words, in the example above it is not possible to use where
to simply replace let
(without perhaps using some more verbose case
expression combined with where
).