I'm trying to debug why despite combining optionMaybe with try, parsec is consuming the input. Basically in the below code, why is the second run not returning Right "abc" (which is what I expect)?
Given
myParser = do
optionMaybe $ try (between (char '/') (char '/') $ many1 (noneOf "/")
many1 (noneOf "/")
I get
> parse myParser "" "/abc/def"
Right "def"
> parse myParser "" "/abc"
Left (line 1, column 5):
unexpected end of input
expecting "/"