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
Change 'tag' to return Nothing, rather than throw an exception. #93
Conversation
This allows parsers to conditionally accept a tag, depending on it's attributes.
I'm overall 👎. It's a semantically breaking API change without any change in the type of the function. Also, I haven't used this layer of the API in a while, but I think this will leave the stream in an inconsistent state. |
I'd be more than happy to move this functionality into a different function, leaving |
You're right, I wasn't looking at enough of the code. The fact is that I'm not intimately familiar with these combinators anymore. It does seem like a breaking change to switch to |
You are right that it is breaking in the sense that if I have a parser As I said, if you oppose this breakage I'm okay with moving the behaviour into a different combinator and leaving 'tag' as-is, but the inability to "fail" and try a new parser based on the attributes of a tag is a real issue when scraping messier XML. |
OK, for now let's do it in a new function. We can consider deprecating the old one in favor of the new one if that makes sense. |
Since there's so many versions of the combinators using |
If we're already discussing a new module, it may make sense to simply move all of the combinators into a separate package which isn't tied to the API compatibility of this package. Then you'd be free to modify the behavior quickly without worrying about breakage, and when stable, we could deprecate the combinators in xml-conduit and point to the new package. |
My main objection to that would be duplicating all the code currently in
where the first argument is the "failure" case, which means the current So that both current behaviour and my proposed behaviour can be defined as a list of trivial specialisations (as above), which avoids duplicating the code and maintenance. The only real issue/question I had was whether it'd be better to export both versions from the the same module (i.e. I don't feel duplicating all the other code in the module to a new package would be beneficial as then any changes/fixes in |
Sorry to chime in, but I'd like to suggest a different strategy:
This way, the API remains clean (no renaming, no duplicated code/module/package), users are warned about the incompatible change, and the new behavior is opt-in. What do you say ? :) |
I wouldn't trust preferred versions for much to be honest. Also to be honest: I think this package deserves to have an additional maintainer, as for the past four years my work has required significantly less XML work. You've contributed a lot @k0ral; would you be interested? |
@snoyberg Maybe I misunderstood, but I already enlisted as co-maintainer for |
Doh, right you are!
…On Thu, Jan 26, 2017, 8:51 PM k0ral ***@***.***> wrote:
@snoyberg <https://github.com/snoyberg> Maybe I misunderstood, but I
already enlisted as co-maintainer xml-conduit.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#93 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AADBB0bdxZrFfp0300gVD_Tflv_jtZyRks5rWOsjgaJpZM4LoOkb>
.
|
Ok, so is there any preferred approach? I don't mind doing the work, but I'm a bit unclear what to actually do to see this get into xml-conduit :) |
If @k0ral wants to make the decisions here, I'm happy to defer. |
Actually, @k0ral, I just realised some other combinators I would really like to see in |
hey guys, can you still see this even tho this is long closed? i'm trying to figure out how to succeed/fail conditional on an attribute value. but so far i can't figure it out -- can you include an example in the docs? and one for i thought i had figured out the "trivial" method using |
This allows parsers to conditionally accept a tag, depending on it's attributes. I frequently find myself needing to decide whether to accept a tag based on it's attributes, which isn't possible with the current xml-conduit API, this simple change makes this operation trivial.
See also #60 (which already has a pull request, but I think that solution is needlessly complex).