-
Notifications
You must be signed in to change notification settings - Fork 0
/
mandelbrot-01.debug.elm
46 lines (31 loc) · 1 KB
/
mandelbrot-01.debug.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
38
39
40
41
42
43
44
45
46
import Html exposing (Html, Attribute, button, div, text)
import Html.Events exposing (onClick)
import Html.Attributes exposing (style)
main =
Html.beginnerProgram { model = model, view = view, update = update }
-- MODEL
type alias Model = List (Point, Point)
type alis Point { x: Int, y: Int}
model : Model
model = [ (Point 0 0, Point 0 1)
, (Point 0 1, Point 1 1)
, (Point 1 1, Point 0 1)
, (Point 1 0, Point 0 0) ]
-- UPDATE
type Msg = Increment | Decrement
update : Msg -> Model -> Model
update msg model =
case msg of
Increment ->
model + 1
Decrement ->
model - 1
-- VIEW
view : Model -> Html Msg
view model =
div []
[ div [ style [("display"), ("inline-block")] ] [ button [ onClick Decrement ] [ text "-" ] ]
, div [ style [("display"), ("inline-block")] ] [ div [] [ text (toString model) ] ]
, div [ style [("display"), ("inline-block")] ] [ button [ onClick Increment ] [ text "+" ] ]
, div [] [ svg [ style [("width", "500"), ("height", "500")]] [] ]
]