Lexical error in Haskell when concatenating strings

1.7k views Asked by At

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

There are 1 answers

0
Mihai Maruseac On BEST ANSWER

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