Edit: Okay, I know nothing is wrong with this, but I don't know why it isn't giving output
let y = 2 * x where x = sum[1..3]
I only wonder, because this other expression DOES give output
let x = sum[1..3] in 2 * x
Edit: Okay, I know nothing is wrong with this, but I don't know why it isn't giving output
let y = 2 * x where x = sum[1..3]
I only wonder, because this other expression DOES give output
let x = sum[1..3] in 2 * x
Ah. So let ... in ... is an expression. However, let ... can also occur in a do block. I encourage you to think of GHCi's behaviour as follows: if you enter something that just looks like a raw expression, it evaluates it and prints the result. On the other hand, if what you entered looks like it might belong in an IO do block, it will simply execute that action. - @Alec