NOTE: this package is not compatible with Elm 0.19.1
An experimental routing library.
Note: When this ceases to be experimental, it will probably be split into its own package.
Given a list of routes, find the first that matches the prefix string. Pass the remainer of the string to the route function to get a result.
Example:
type View = BlogPost String | FrontPage routes : List (String, String -> Maybe View) routes = [("blogpost/", Just << BlogPost) ,("", always (Just FrontPage))] > matchRoutes routes "blogpost/hello" => Just (BlogPost "hello")
A route is a pair of (the string prefix to match on, a function that turns the suffix into the type you're parsing for.
Given a list of routes, find the first that matches the prefix string. Pass the remainer of the string to the route function to get a result.
Example: