What's wrong with using Html.map?

If you have a (Msg -> msg) function, you might use it through Html.map (or Cmd.map in an update function):

someView : (Msg -> msg) -> Model -> Html msg
someView toMsg model =
    Html.div
         [ onClick DoStuff ]
         [ ... ]
         |> Html.map toMsg

I could have done that without Html.map, but just wanted to show it can be useful in this pattern too.

1 Like