I am currently learning Haskell from the online version of Learn You a Haskell, and I'm in Chapter 4: Syntax in Functions. While going through the book, I code up all the sample functions verbatim into my text editor (Notepad++) and run it on GHCI.
The most recent function I did is starting to annoy me (it's in the Guards, Guards! section of Chapter 4).
initials :: String -> String -> String
initials firstname lastname = [f] ++ "." ++ [l]
where (f:_) = firstname
(l:_) = lastname
This is my code, and it's also the code that is shown in the book. Whenever I write it myself, the GCHI always gives me the parse error. However, when I copy/paste it from the book, it works. The funny part is that there's no difference. I copy/pasted the code over mine and there was literally no difference between them. I did this several times, so I'm certain I'm not being delusional.
Why is this happening? How can I fix it? I looked it up at first, but all I see is that the two statements after the "where" have to be aligned in the same column. I'm doing that. It's still not working.