network-uri
network-uri copied to clipboard
Export URI parser
The library exports String -> Maybe URI
functions, but this is not easy to compose with other parsers. For example, I'm writing a tokeniser that needs to identify URIs and a bunch of other stuff. I have to do some tedious gymnastics to fit parseURI
in, but if I had access to the actual Parser
itself, it would be much easier.
I think that's reasonable. My only hesitation would be, it exposes the "implementation detail" of which parser-combinator library we happen to use (Parsec at the moment). That said, the library has been so stable for so long, I doubt we would ever change the combinator library.
I'll work something up that we can talk about.
@ocharles if you have any sample code where you'd like to use these combinators, I'd be interested to see it, to appreciate the need this is filling. Also see the above pull request and let me know what you think.
I actually have ended up hand-rolling a parser now, and having the parsec
parser exposed probably wouldn't help. My tokeniser is written using regex-applicative
, and I was hoping to not need to write a URI parser myself. However, for other reasons the parser I need isn't quite what the URI specification is, anyway.
So tl;dr, I no longer actually need this. I still think it would be worthwhile to export, but can also appreciate not wanting to increase the surface area of the API.
Shall I close this issue, or leave it open?
OK, that makes sense. I'm willing to consider exporting the parser, but in the absence of more people saying they'd like to see it, I'll remain cautious for now.
And, perhaps we'll leave the issue open for now in case others want to voice their interest. Sound good?
Perfect!