-
Notifications
You must be signed in to change notification settings - Fork 9
/
example.elm
37 lines (29 loc) · 693 Bytes
/
example.elm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
module Main exposing (..)
import Browser
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
update : Msg -> Model -> Model
update msg model =
case msg of
Increment ->
model + 1
Decrement ->
model - 1
main =
Browser.sandbox { init = 0, update = update, view = view }
type alias Model a b c = Int (List a)
type Msg
= Increment
| Decrement
view model =
div []
[ button [ onClick Decrement ] [ text "-" ]
, div [] [ text (String.fromInt model) ]
, button [ onClick Increment ] [ text "+" ]
]
view : Model -> Int
view model =
1
example { x, y } = x + y
example [ x, y ] = x + y
example x y = x + y