elm-lang / elm-reactor

Interactive development tool that makes it easy to develop and debug Elm programs.
BSD 3-Clause "New" or "Revised" License
428 stars 63 forks source link

The argument to function `beginnerProgram` is causing a mismatch. #226

Open Kennedy-s opened 7 years ago

Kennedy-s commented 7 years ago

I am having a problem creating a login form and am getting along that mismatch problem and this are my codes am using

import Html.Attributes exposing (..) import Html exposing (..) import Http import Svg exposing (..)

main = Html.beginnerProgram { model = model , view = view , update = update }

-- Model

type alias Model = { username : String , password : String , login : String }

model : Model model = { username = "" , password = "" , login = "" }

-- Update

type Msg = Username String | Password String | Login String

update msg model = case msg of login -> ( model, Cmd.none)

-- View view : Model -> Html Msg view model = Html.form [ id "login-form" ] [ Html.h1 [] [ Html.text "Sensational Login Form" ] , Html.label [ for "username-filed" ] [ Html.text "username" ] , input [ id "username-filed" , type "text" , value model.username ] [] , label [ for "passwortd-field"] [ Html.text "password: " ] , input [ id "password-field" , type "password" , value model.password ] [] , div [ class "login-button" ] [ Html.text "Log In" ] ]

-- Subscriptions

process-bot commented 7 years ago

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

devjason commented 7 years ago

The type signature for update in Html.beginnerProgram is Msg -> Model -> Model, not Msg -> Model -> (Model, Cmd Msg). If you are wanting to use commands as part of your update you may want to try using Html.program.

Kennedy-s commented 7 years ago

Thanks a lot Devjason it's working now