Is there a legitimate reason for `never`

But I found that instead of Html Never one can just use Html msg as a type for the static Html which is perfectly fine when no Event handlers are used.

For most practical purposes this is indeed correct. However one can define this useless Html msg view which attaches event msg event even without passing a way to construct msg:

module NeverIsForever exposing (viewEndOfTheUniverse)

import Html exposing (Html)
import Html.Events as Events

msg : (a -> a) -> a
msg f =
    msg f


viewEndOfTheUniverse : Html msg
viewEndOfTheUniverse =
    Html.div [Events.onClick <| msg identity] []

don’t try this at home

1 Like