module Main exposing (main)

import MyHtml exposing (program, text, a, onClick, div)


type Msg
    = Inc
    | Dec


main =
    program
        { init = ( 0, Cmd.none )
        , update =
            \msg model ->
                case msg of
                    Inc ->
                        ( model + 1, Cmd.none )

                    Dec ->
                        ( model - 1, Cmd.none )
        , subscriptions = \model -> Sub.none
        , view =
            \model ->
                div []
                    [ text (model |> toString)
                    , a [ onClick Inc ] [ text "+" ]
                    , a [ onClick Dec ] [ text "-" ]
                    , div [] (List.repeat model (text "."))
                    ]
        }