What does a function with 2 values on the right side mean? (Model -> Html msg)

前端 未结 2 2047
孤独总比滥情好
孤独总比滥情好 2021-02-13 22:40

I have encountered that in the guide:

viewValidation : Model -> Html msg
viewValidation model =
  let
    (color, message) =
      if model.password == model.         


        
2条回答
  •  猫巷女王i
    2021-02-13 22:43

    Html Msg is just a type parameter, as List Int is. While List Int denotes a list that contains element of type Int, similarly Html Msg describes some HTML that can treat/emit messages of type Msg.

    For example, if you have a button inside your HTML, it could look like this:

    button [ onClick DoSomething ] [ text "caption" ]
    

    Where DoSomething is a case of the Msg type.

提交回复
热议问题