Skip to content

Commit 3707b22

Browse files
committed
Make update smaller
1 parent 2936ab6 commit 3707b22

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

nesting/1-counter-pair.elm

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,16 @@ type Msg
4141

4242

4343
update : Msg -> Model -> Model
44-
update msg model =
45-
case msg of
44+
update message model =
45+
case message of
4646
Reset ->
4747
init 0 0
4848

49-
Top topMsg ->
50-
let
51-
newCounter =
52-
Counter.update topMsg model.topCounter
53-
in
54-
{ model | topCounter = newCounter }
49+
Top msg ->
50+
{ model | topCounter = Counter.update msg model.topCounter }
5551

56-
Bottom bottomMsg ->
57-
let
58-
newCounter =
59-
Counter.update bottomMsg model.bottomCounter
60-
in
61-
{ model | bottomCounter = newCounter }
52+
Bottom msg ->
53+
{ model | bottomCounter = Counter.update msg model.bottomCounter }
6254

6355

6456

@@ -72,4 +64,4 @@ view model =
7264
[ App.map Top (Counter.view model.topCounter)
7365
, App.map Bottom (Counter.view model.bottomCounter)
7466
, button [ onClick Reset ] [ text "RESET" ]
75-
]
67+
]

0 commit comments

Comments
 (0)