network-uri icon indicating copy to clipboard operation
network-uri copied to clipboard

Export URI parser

Open ocharles opened this issue 4 years ago • 5 comments

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.

ocharles avatar Nov 14 '20 19:11 ocharles

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.

ezrakilty avatar Nov 19 '20 05:11 ezrakilty

@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.

ezrakilty avatar Nov 19 '20 06:11 ezrakilty

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?

ocharles avatar Dec 12 '20 13:12 ocharles

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?

ezrakilty avatar Dec 23 '20 20:12 ezrakilty

Perfect!

ocharles avatar Dec 23 '20 21:12 ocharles