I'm a beginner in haskell and trying to do a cipher validate function.
validateCipher :: [Char] -> Bool
validateCipher cipher =
if length $ nub cipher == length cipher
then return True
else return False
When I run it through ghci, it just told me: error: parse error on input ‘validateCipher’. Not sure what is going wrong, should I add Eq or any stuff(I don't quite sure what does it do either)?
return. In Haskell there is noreturnkeyword, there is only areturnfunction. Furthermore the$results in parsing it as `length (nub cipher == length cipher), so you should use brackets.