evancz / url-parser

Parse URLs into nicely structured data
http://package.elm-lang.org/packages/evancz/url-parser/latest/
BSD 3-Clause "New" or "Revised" License
114 stars 29 forks source link

Feature Request: Scotty-like route creation #55

Closed Qqwy closed 6 years ago

Qqwy commented 6 years ago

In Haskell, there is the Scotty framework which has a very interesting approach to routing

Blog article here: https://www.spock.li/2015/04/19/type-safe_routing.html

The idea is that the router is both able to, from the specification that the user creates, parse what route matches the given path, but also to create a path when given parameters.

I do not know how much this implementation relies on features that Elm does not have, but if possible I think it would be a very interesting area to expore, because in all Elm applications I've seen, all URLs are created both forwards and backwards manually currently.

evancz commented 6 years ago

That appears to rely crucially on the Typeable class in var :: (Typeable a, PathPiece a) => Path '[a]. I don't fully know what that is used for, but if it is possible in Elm, I think it should be pursued in a community experiment before being incorporated here.