while learning the parsec tutorial , I tried the fllowing command
print (Parsec.parse (Parsec.many (Parsec.choice [Parsec.letter,Parsec.spaces ,(Parsec.char ','), Parsec.digit])) "" "hello1 , byebye2 ," )
I am not sure how to fix this. How this can be fixed, any ideas??
From hackage
spaces :: Stream s m Char => ParsecT s u m ()
letter :: Stream s m Char => ParsecT s u m Char
so you have parser, that try to give you Char
s and one, that just drops input and gives you ()
. What should the result be?
You could use
space :: Stream s m Char => ParsecT s u m Char
or
(spaces *> return ' ')
instead of just spaces
depends on the behavior you want.