concept browser.application in category elm

appears as: Browser.application
Elm in Action

This is an excerpt from Manning's book Elm in Action.

The onUrlRequest and onUrlChange functions in Browser.application give us the power to pull off this magic trick. Let’s wire them up, replacing our placeholder Msg type with one that has two variants:

type Msg
    = ClickedLink Browser.UrlRequest
    | ChangedUrl Url

Now let’s replace the Debug.todo calls we made in Browser.application with these variants:

Receiving the URL with Browser.application

To examine the initial page URL, we’ll need to upgrade Browser.document to Browser.application. As it turned out, that wasn’t even our final form!