4 ms·
The problem with monadic parsers is that they are too powerful. If you have two options string "foo" <|> string "for" It would be nice to automatically re
by Tarean 9y ago
The problem with monadic parsers is that they are too powerful. If you have two options
string "foo" <|> string "for"
It would be nice to automatically rewrite this as
string "fo" >> (char 'o' <|> char 'r')
But if we try to analyze monadic parsers like that we run into the halting problem.
Applicative parsers are less powerful so we can left factor them automatically. There were some attempts to combine applicative and monadic parsers which resulted in arrow syntax but that kind of feels like the worst of both worlds for many cases.