Implement a format-like syntax extension.
Using ppx, it should be rather easy to do. Something of the form:
{furl|foo.org/bar/%i*?babar=%f?|furl}
This would allow to keep a readable syntax while avoiding the value restriction, since we would build the value directly (instead of using the combinators).
For matching, something along the lines of
match%furl uri with
| {|....|} x y z -> body
| _ -> default
It appears that '?' for the option is troublesome. It conflicts with end-of-path '?' which makes the syntax clumsy and prevent usage of uri.
The matching syntax was rather trivial to implement.
An interesting point is that we could change the above snipet to something like that:
match%furl uri with
| {|foo.com/{label:x}|} -> ... do_something label ....
| _ -> default
We could also use a similar syntax to provide labeled construction function but I'm afraid there will be weird constraints, much like Lwt_log's syntax extension.
Another issue is that I don't see how to compose existing piece of furl inside the ppx, which is pretty much the opposite of furl's objective.
An interesting lead is URI templates, see an implementation and the RFC.