[acc-errors] Accumulate errors for Seq and Vector parsers#600
Open
bergmark wants to merge 4 commits intoacc-errorsfrom
Open
[acc-errors] Accumulate errors for Seq and Vector parsers#600bergmark wants to merge 4 commits intoacc-errorsfrom
bergmark wants to merge 4 commits intoacc-errorsfrom
Conversation
phadej
reviewed
Oct 29, 2017
Data/Aeson/Types/Internal.hs
Outdated
|
|
||
| accumulateTraverseVector :: (a -> Parser b) -> Vector a -> Parser (Vector b) | ||
| accumulateTraverseVector f v = | ||
| if V.null v |
Collaborator
There was a problem hiding this comment.
I wonder, if it makes sense to define
newtype AccParser a = AccParser { runAccParser :: Parser a }
instance Applicative AccParser where
AccParser f <*> AccParser x = AccParser (f <*>+ x) -- !!!and use it, and not re-implement traverse for everything.
Collaborator
There was a problem hiding this comment.
I agree, it's a good idea to use Traversable here. Reexporting Parser versions that use AccParser under the hood is nice too.
Collaborator
Author
|
I'm not sure when I'll get around to playing more with this, so feel free to steal the commit if anyone wants to keep going before I get the chance. |
b506cfd to
ded0a7d
Compare
ded0a7d to
09703bb
Compare
Collaborator
Author
|
I changed this to use an |
09703bb to
9eef7e7
Compare
61ab5a9 to
584135e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Naming has room for improvements, maybe we should even have a module for accumulation related functions, or should we do this in some other way like using a newtype so we can have proper traversable instances (not sure if that'll work out)?
Ping @Lysxia