rgrempel / elm-route-url

Router for single-page-apps in Elm
http://package.elm-lang.org/packages/rgrempel/elm-route-url/latest
MIT License
196 stars 16 forks source link

Elm 0.18 #19

Closed pzingg closed 7 years ago

pzingg commented 7 years ago

I gave myself an exercise to update your package to Elm 0.18. I'm somewhat of an Elm newbie so I just could not get the "withFlags" and "withoutFlags" variants to compile following the way you extended AppWithFlags in your Elm 0.17 version. So you will see a lot of duplication of code.

The 5ef8746 commit actually compiled without all the unnecessary copying, but when I tried to run the examples in elm-reactor, I got this curious run-time message:

"Are you trying to sneak a Never value into Elm? Trickster! It looks like Main.main is defined with programWithFlags but has type Program Never."

I guess because it doesn't the underlying program having flags, but being called as Program Never.

I also did a bit of copying in the examples, because the Elm 0.18 version of Http doesn't include the url method anymore. I grabbed the code from Elm 0.17 and put it inline in Examples 5, 6, and 7, renaming the method urlWithArgs.

pzingg commented 7 years ago

I refactored things in commit 6471019 to remove all the copying. See if it works for you.

pzingg commented 7 years ago

I used elm-make --warn to generate the type annotations for the "Impl" functions that were not annotated in 6471019, so 3cd56fc now is fully annotated.

fycth commented 7 years ago

@rgrempel please, accept this PR!

rgrempel commented 7 years ago

This is impressive -- I had started on updating for Elm 0.18, but not gotten this far. Thanks!

I expect it will take me a few days to review all of this.

pzingg commented 7 years ago

I enjoyed using your package as a learning tool. i also dissected things and put them back another way--it's not as slick an encapsulation, but ends up exposing what is going on under the hood a little more. You can see that approach here: http://package.elm-lang.org/packages/pzingg/elm-navigation-extra/latest

It's probably more error-prone to someone forgetting to make certain "router" calls, but it doesn't add that much complexity to a stock Navigation.program.

MarkNijhof commented 7 years ago

How do I go about using the @pzingg repository until this (or something else) is merged?

rgrempel commented 7 years ago

Thanks again for your work on this!

I've pretty much got my additional changes ready to go on #22 -- I'll take one more look through that tomorrow and then hopefully publish the new version.

mblarsen commented 7 years ago

@pzingg @rgrempel great work.

Has it been published yet?

rgrempel commented 7 years ago

I got caught up in other things -- hopefully tomorrow.

rgrempel commented 7 years ago

Now published as version 3.0.