module Website03Counter exposing (..) import Browser import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (..) type alias Model = Int type Message = Increment | Decrement view : Model -> Html Message -- the msg is a type argument, it means Html should expect "action" parameters to be of type Message view model = div [ class "well container" ] -- the [] in div [] is a list of attributes; currently this is empty [ node "link" [ rel "stylesheet", href "https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" ] [] , button [ onClick Decrement ] [ text "-" ] , text (" " ++ String.fromInt model ++ " ") , button [ onClick Increment ] [ text "+" ] {-- --} ] initialModel : Model initialModel = 0 update : Message -> Model -> Model update message model = case message of Increment -> model + 1 Decrement -> model - 1 -- the next parameter taken by div is a list representing the sub-elements in the html document main : Program () Model Message main = Browser.sandbox { init = initialModel , view = view , update = update }