I'm new to haskell and cannot work out what is wrong with my code. I keep getting a variable out of scope error.
Here is my code that i load into GHCi using :load
validLength :: String -> Bool
validLength xs | length xs == 26 = True
| otherwise = False
I then type validLength aa which should return false but i'm getting an error.
*Main> validLength aa
<interactive>:1:13: error: Variable not in scope: aa :: String
validLength "aa". - leftaroundaboutaawhich, likely, does not exists. If you want to pass aString, you should usevalidLength "aa". - Willem Van Onsem==already returns a boolean. There is no need to check if that is true, and then returnTrue/Falseaccordingly. You can directly return the result of==e.g.isZero x = x == 0. - chivalidLength xs = length xs == 26. - chepner