nonpop/elm-purl/2.0.0

NOTE: this package is not compatible with Elm 0.19.1

elm-purl

A tiny library for building parameterized URLs. It is intended to be used with records to give the parameters names and therefore reducing errors.

import Url exposing (Url, (</>), (<?>), (@), root, s, int, bool)

userUrl : Url { id : Int }
userUrl = root </> s "users" </> int .id <?> ("show", bool .show)

userUrl @ { id = 42, show = True } == "/users/42?show=true"

Full API documentation.