2

I am trying to insert a character ('A') into a string in Haskell my code is as follows:

split :: Int -> String -> String
split n s 
    |s == [] = s
    |otherwise = let (a,b) = splitAt n s in “A” ++ split n b

However, it keeps throwing up " lexical error at character '\8220' " on the otherwise line. Im new to Haskell and any help would be much appreciated.

1 Answer 1

3

Change to". It's a different Unicode character. You have which is left double quation mark while the standard lexical element is the simple quotation mark (")


Also, since you're adding a single letter, you can also use 'A' : split n b

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.