-2

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 ," )

and the error in console was enter image description here

I am not sure how to fix this. How this can be fixed, any ideas??

Shaurya
  • 136
  • 1
  • 4
  • 20

1 Answers1

1

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 Chars 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.

typetetris
  • 4,586
  • 16
  • 31