marcosh
marcosh

Reputation: 9008

Elm obtain Html Never

I have a normal view function view : Model -> Html Msg.

Now I need to product from that view a Html Never, which just removes all the event handlers.

My first idea was to use Html.map with a function Msg -> Never but I don't know how to define it since Never has no values.

Is there a trick to make this work?

Upvotes: 1

Views: 675

Answers (1)

Tomáš Zemanovič
Tomáš Zemanovič

Reputation: 737

Html Never would be a view without any event handlers. If you want to map this view to the type Html Msg you can use Html.map never. The function never is defined in the core.Basics.

I'd actually recommend to instead use a generic type for your view without event handlers, such as Html x and then you don't have to do any mapping at all.

Upvotes: 2

Related Questions