- A generic DSL for expressing arbitrarily-nested dynamic routes (at the cost of uglier route constructors as the depth increases).
- An automatic way to do reverse routing that when coupled with a small amount of boilerplate should provide the safest approach to reverse routing that the Elm language can currently support.
elm-route-parser is another type safe route parsing library. In
elm-route, its more rigid matchers make it possible to have
cleaner route constructors (for example,
HomeR instead of
It does not yet provide automatic reverse routing support.
Here's a short taste of what the DSL looks like:
type Sitemap = HomeR () | UsersR () | UserR Int | UserPostR (Int, String) homeR = HomeR := static "" usersR = UsersR := static "users" userR = UserR := "users" <//> int userPostR = UserPostR := "users" <//> int </> string sitemap = router [homeR, usersR, userR, userPostR] match : String -> Maybe Sitemap match = Route.match sitemap route : Sitemap -> String route r = case r of HomeR () -> reverse homeR  UsersR () -> reverse usersR  UserR id -> reverse userR [toString id] UserPostR (uid, pid) -> reverse userPostR [toString uid, pid]