EightyOne Unite
EightyOne Unite

Reputation: 11815

Elm Html and view : Model -> Html Msg

I'm brand new to Elm and I'm struggling to see what is wrong here..

view : Model -> Html Msg
view model = div [] [ button [ onClick NewStrategy ] [ text "-" ] ]

complains that..

The type annotation for `view` says it always returns:

    Html (Msg)

But the returned value (shown above) is a:

    Html (String -> Msg)

It looks no different to http://elm-lang.org/examples/buttons to me. One div with a button inside with an onClick and some text.

What am I missing here?

Upvotes: 0

Views: 950

Answers (1)

Chad Gilbert
Chad Gilbert

Reputation: 36385

You hadn't listed the source code for Msg but the error you've listed seems to indicate that the NewStrategy constructor takes a single string parameter. If you gave it a string value, it should work.

Example:

view model = div [] [ button [ onClick (NewStrategy "submit") ] [ text "submit" ] ]

Upvotes: 3

Related Questions