-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Indentation error lost in alternative #527
Comments
(Just <$> pInd) <|> pure Nothing Since hints are only for non-fancy errors (it is a collection of |
However, why do we need such behavior? Maybe for really user-defined errors there is no visible way to translate them into hints, but for indentation errors in particular it doesn't seems to be complicated to add special hints. These are just some extra Maybe it's not so trivial to compose indentation hints. For example, if we have nested indented blocks:
what's the correct indentation of |
There is no strong conceptual reason why this is not supported. I think it is just not many people use the indentation features much and there was not enough demand for the library to evolve in that direction. There is also the question of balance between features vs complexity of the implementation. |
Suppose we have the following parsers:
If we try to parse the string
"a"
with them we'll get the following errors (which seems to be good enough for me):However, if we'll try them as
optional
, the second one preserve a useful error message:while the first loses it at all:
Why megaparsec behaves so? Are there places where preserving indentation error is undesirable or maybe I'm using wrong combinators here?
The text was updated successfully, but these errors were encountered: