Parsec: concatenate two char parsers into a string

I am trying to write a parser that glues two characters into a string:

(<:>) = liftM2 (\a b -> [a, b])
mychar :: Parser String
mychar = (char '\\') <:> (noneOf "u")

Is it possible to make it more elegant? I'm a newbie. Please, help.

+4
source share
1 answer

Another choice:

mychar = sequence [char '\\', noneof "u"]
+7
source

All Articles