obsidiansystems / obelisk

Functional reactive web and mobile applications, with batteries included.
https://reflex-frp.org
BSD 3-Clause "New" or "Revised" License
959 stars 107 forks source link

Generalise SegmentResult #1079

Open alexfmpe opened 6 months ago

alexfmpe commented 6 months ago

Ran into a non-urls usecase where I wanted to use ([Text], ByteString) instead of ([Text], Map Text (Maybe Text)) and realized the groundwork for #989 allowed me to use ([Text], q) as long as I relaxed the type signatures so I pulled that bit into this separate, more conservative PR.

The tutorial describes the PageName version of pathComponentEncoder. Should that be updated with this PR or do we keep it simple?

I have:

alexfmpe commented 6 months ago

Ended up also locally defining a variant of queryOnlyEncoder with the more general type.

I wonder if this should be more of a generalise-query-type thing.

In theory we could do the same for path, so instead of PageName everywhere, unless url-specific we'd instead have ([fragment], query) but I don't actually have a use-case for that so hard to tell what exactly to generalise to. What even is a generic path afterall?

At least allowing () locally as the query type seems pretty convenient and common