-
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
MonadAccum instance for ParsecT #522
Comments
|
It is not there because at the time no such thing as |
It's clear about |
MonadWriter can be done, but it is not so straightforward because of listen and pass. I have an implementation and file a PR asap.
Olaf
…________________________________
Von: Lev Dvorkin ***@***.***>
Gesendet: Dienstag, 20. Juni 2023 22:46
An: mrkkrp/megaparsec ***@***.***>
Cc: Olaf Klinke ***@***.***>; Author ***@***.***>
Betreff: Re: [mrkkrp/megaparsec] MonadAccum instance for ParsecT (Issue #522)
It's clear about MonadAccum, but why there is no MonadWriter instance (it seems to be old enough)? Are there any problems with it?
—
Reply to this email directly, view it on GitHub<#522 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AUGVV4IKWGZAYJUAPO2F3A3XMID3PANCNFSM6AAAAAAWNCCIAA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
The PR is able to merge. |
There exists an instance
and
State
is more expressive thanWriter
, in the sense that any State monad can implement theMonadWriter
interface for monoidal state. Hence I wonder why there are no instancesI claim that accumulating some value while parsing is a frequent use case and therefore should be supported by any parsing library. After all,
ParsecT
does accumulate its own errors and hints. Certainlytell
a.k.a.add
is easy enough to implement:and
look
can be implemented vialift
:The text was updated successfully, but these errors were encountered: