Skip to content

Commit

Permalink
Make update smaller
Browse files Browse the repository at this point in the history
  • Loading branch information
process-bot committed May 18, 2016
1 parent 2936ab6 commit 3707b22
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions nesting/1-counter-pair.elm
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,16 @@ type Msg


update : Msg -> Model -> Model
update msg model =
case msg of
update message model =
case message of
Reset ->
init 0 0

Top topMsg ->
let
newCounter =
Counter.update topMsg model.topCounter
in
{ model | topCounter = newCounter }
Top msg ->
{ model | topCounter = Counter.update msg model.topCounter }

Bottom bottomMsg ->
let
newCounter =
Counter.update bottomMsg model.bottomCounter
in
{ model | bottomCounter = newCounter }
Bottom msg ->
{ model | bottomCounter = Counter.update msg model.bottomCounter }



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

0 comments on commit 3707b22

Please sign in to comment.