sporto / elm-example-app

An example Elm single page application
436 stars 85 forks source link

tutorial not working on the routing step #7

Closed larfadin closed 8 years ago

larfadin commented 8 years ago

Hi, I'm doing the tutorial and I'm here: http://www.elm-tutorial.org/070_routing/main_view.html I have copy and past everything so it's not an error from me.

I have this error:

-- NAMING ERROR ------------------------------------------------- ./src/View.elm

Cannot find pattern `Routing.PlayersRoute`.

26│     Routing.PlayersRoute ->
        ^^^^^^^^^^^^^^^^^^^^
`Routing` does not expose `PlayersRoute`. 

-- NAMING ERROR ------------------------------------------------- ./src/View.elm

Cannot find pattern `Routing.PlayerEditRoute`.

29│     Routing.PlayerEditRoute playerID ->
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`Routing` does not expose `PlayerEditRoute`. 

-- NAMING ERROR ------------------------------------------------- ./src/View.elm

Cannot find pattern `Routing.NotFoundRoute`.

32│     Routing.NotFoundRoute ->
        ^^^^^^^^^^^^^^^^^^^^^
`Routing` does not expose `NotFoundRoute`. 

My router just look like this: http://www.elm-tutorial.org/070_routing/router.html

sporto commented 8 years ago

Hi @larfadin
Yesterday I upgraded the tutorial from Hop 2.1 to Hop 3.0 This is probably the issue, I'm sorry about this.

Does your Routing module have this:

type Route
  = PlayersRoute
  | PlayerEditRoute PlayerId
  | NotFoundRoute

If not could you please go back to the beginning of that chapter? From http://www.elm-tutorial.org/070_routing/router.html

larfadin commented 8 years ago

Thanks a lot, I did it again and it works. I actually got no luck because I was doing the tutorial when you were updating it. I also find 1-2 error. First one: in http://www.elm-tutorial.org/070_routing/main.html you write:

port routeRunTask : Task.Task () ()
port routeRunTask =
  router.run

instead of

port routeRunTask : Task.Task () ()
port routeRunTask =
  Routing.run

The second one (I'm not sure it's an error it just look strange to me): in Routing.elm there is two match 1

indexMatcher : PathMatcher Route
indexMatcher =
  match1 PlayersRoute "/"

playersMatcher : PathMatcher Route
playersMatcher =
  match1 PlayersRoute "/players"

playerEditMatch : PathMatcher Route
playerEditMatch =
  match3 PlayerEditRoute "/players/" int "/edit"
sporto commented 8 years ago

Thanks, fixed the issue with Routing.run The second one is not an error