initials :: String -> String -> String
initials firstname lastname = [f] ++ ". " ++ [l] ++ "."
where (f:_) = firstname
(l:_) = lastname
For this code. I got error
parse error on input `='
Why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You use a tab character before the
wherekeyword. To GHC it looks like this:So, GHC thinks that the first line in the
whereblock starts at column 14 (tab counts for 8 columns iirc) while the second line starts at column 9, which causes the error.You should use a good text editor that converts tabs into 4 spaces for you.