I'm playing around with GHCi for the first time, and I'm having some trouble writing multi-line functions.
My code is as follows:
Prelude> :{
Prelude| let diffSquares lst = abs $ squareOfSums lst - sumOfSquares lst
Prelude| where
Prelude| squareOfSums lst = (fst (sumsAndSquares lst))^2
Prelude| sumOfSquares lst = snd (sumsAndSquares lst)
Prelude| sumsAndSquares = foldl (\(sms,sqrs) x -> (sms+x,sqrs+x^2)) (0,0)
Prelude| :}
It gives the following error:
<interactive>:1:142: parse error on input `='
Could someone kindly point me in the direction of what I'm missing?