0

I was doing an exercize from the Haskellwiki (99 questions) and I am getting "exercize.hs:1:12: parse error on input ‘->’ ":

myLast [a] -> a
myLast [] = error "Empty list has no last element"
myLast [x] = x
myLast (_:xs) = myLast xs

I am using Notepad++ on a Win8.1, the compiler is GHCi. I rewrote it many times and I can't see a mistake. Why is this happening?

1 Answer 1

1

You forgot the ::

myLast :: [a] -> a
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.