elm / url

Build and parse URLs. Useful for HTTP and "routing" in single-page apps (SPAs)
https://package.elm-lang.org/packages/elm/url/latest/
BSD 3-Clause "New" or "Revised" License
74 stars 43 forks source link

Clean up Example.elm #49

Open ForgottenGensym opened 3 years ago

ForgottenGensym commented 3 years ago

There were a couple of problems in examples/Example.elm that I wanted to help out with:

  1. Not well commented, these kind of example programs are extremely helpful for learning the way things work, having both the code (example program) and documentation (comments) in one place and linked to each other is a powerful tool for understanding a new library. It's not a necessity, but in my opinion it can really help.
  2. The use of Debug.toString, which is not considered suitable for production use (afaik at least by the community). I wrote a routeToString function instead, which does add some boilerplate, but I think that the use of Debug.toString should be discouraged. On the other hand, the history tab is, in a way, debugging. I'm open to changing it or not, but I do think that Debug.toString should be, as previously mentioned, discouraged.
  3. A typo ("Uknown URL")

These are all things that aren't major issues, and a lot of it is somewhat opinionated on my behalf. I'm more than happy to drop some (or all) of them, but I really do think this could help out.