Now I'w working on my university homework and one of the tasks is to add string literals support in my Haskell parser of dummy programming language (named "Hi").
I solved this task with that code:
parseString = do
res <- char '\"' *> manyTill charLiteral (char '\"')
return (HiValueString (pack res))
But I don't understand how to solve this task using between
?
I want to make code of this parser shorter, like:
parseString = do
res <- between '\"' '\"'
return (HiValueString (pack res))