This function is defined in the book Real World Haskell.
--file ch03/Lending.hs
lend amount balance = let reserve = 100
newBalance = balance - amount
in if balance < reserve
then Nothing
else Just newBalance
I try to run this in the interpreter, and end up with this error:
Lending.hs:3:54: parse error on input `='
Line 3 is "newBalance = balance - amount" I don't think this is a white space issue so I am genuinely confused.
Edited to align the two local variable declarations:
--file ch03/Lending.hs
lend amount balance = let reserve = 100
newBalance = balance - amount
in if balance < reserve
then Nothing
else Just newBalance
The error persists:
Lending.hs:3:68: parse error on input `='