{"action":"opened","issue":{"url":"https://api.github.com/repos/TheSeamau5/elm-router/issues/3","labels_url":"https://api.github.com/repos/TheSeamau5/elm-router/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/TheSeamau5/elm-router/issues/3/comments","events_url":"https://api.github.com/repos/TheSeamau5/elm-router/issues/3/events","html_url":"https://github.com/TheSeamau5/elm-router/issues/3","id":100821738,"number":3,"title":"parameters in routes / alternate API design","user":{"login":"vilterp","id":7341,"avatar_url":"https://avatars.githubusercontent.com/u/7341?v=3","gravatar_id":"","url":"https://api.github.com/users/vilterp","html_url":"https://github.com/vilterp","followers_url":"https://api.github.com/users/vilterp/followers","following_url":"https://api.github.com/users/vilterp/following{/other_user}","gists_url":"https://api.github.com/users/vilterp/gists{/gist_id}","starred_url":"https://api.github.com/users/vilterp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vilterp/subscriptions","organizations_url":"https://api.github.com/users/vilterp/orgs","repos_url":"https://api.github.com/users/vilterp/repos","events_url":"https://api.github.com/users/vilterp/events{/privacy}","received_events_url":"https://api.github.com/users/vilterp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-13T17:14:33Z","updated_at":"2015-08-13T17:14:33Z","closed_at":null,"body":"Maybe using different types like this:\r\n\r\n```elm\r\ntype alias Router a =\r\n  List (String, (List String -> a))\r\n\r\ntype Page\r\n  = IndexPage\r\n  | BlogPost String\r\n\r\nmyRouter : Router Page\r\nmyRouter =\r\n  [ \"/\" :-> (always IndexPage)\r\n  , \"/post/:slug\" :-> (\\[slug] -> BlogPost slug)\r\n  ]\r\n\r\ntype alias URL = String\r\n\r\nmatch : Router a -> URL -> Maybe a\r\nmatch = ...\r\n```\r\n\r\nI've seen the `/:param_name` syntax in Rails, react-router, Ember, etc; seems to work well. It could also allow you to do something like this:\r\n\r\n```elm\r\nurlFor : Router a -> a -> URL\r\nurlFor = ...\r\n\r\n-- urlFor (BlogPost \"elm-is-cool\") => \"/post/elm-is-cool\"\r\n```\r\n\r\nIf you put this in as a link's `href`, when the browser goes to it it'll trigger that route."}}