You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Oh! I see the differences between approaches. If there is generic lens from newtype to query type that effectively means that all uris have the same implicit type. And when there is _AbsoluteURI that means that those things are different entities with different types.
That's another question: why uri can't be implemented as pathy using phantoms? I mean phantoms around newtyped records.
The URI type variations have more differences than just the path type - some aren't allowed to have query/fragment, etc. All the stuff in here is based on the spec, so the encoding isn't always as natural as it might be, as I was trying to ensure validity in construction (which as it happens isn't right anyway, you can still construct invalid URIs directly if you really try).
The newtype/record approach didn't happen in the end as some more sum components were introduced that made it awkward, but we could still perhaps do something with the class approach for this if it's perceived to be painful enough still 😉
Activity
garyb commentedon Oct 4, 2017
Yeah, I did consider switching to newtypes-of-records when I was working on this but I didn't want to break the API yet again just now.
I'd probably just have
_AbsoluteURI = _Newtype, etc. lenses then, and let them be composed with a general_scheme.cryogenian commentedon Oct 4, 2017
Oh! I see the differences between approaches. If there is generic lens from newtype to query type that effectively means that all uris have the same implicit type. And when there is
_AbsoluteURIthat means that those things are different entities with different types.That's another question: why uri can't be implemented as pathy using phantoms? I mean phantoms around newtyped records.
garyb commentedon Oct 4, 2017
The URI type variations have more differences than just the path type - some aren't allowed to have query/fragment, etc. All the stuff in here is based on the spec, so the encoding isn't always as natural as it might be, as I was trying to ensure validity in construction (which as it happens isn't right anyway, you can still construct invalid URIs directly if you really try).
garyb commentedon Mar 20, 2018
The newtype/record approach didn't happen in the end as some more sum components were introduced that made it awkward, but we could still perhaps do something with the class approach for this if it's perceived to be painful enough still 😉
thomashoneyman commentedon Aug 27, 2020
Is there still any desire for this? #50 re-introduces the newtype/record approach, by the way.