daily pastebin goal
76%
SHARE
TWEET

Untitled

a guest May 16th, 2018 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module First.Update exposing (..)
  2.  
  3. import Material
  4.  
  5.  
  6. --
  7.  
  8. import Model exposing (Model)
  9.  
  10.  
  11. type Msg
  12.     = Reset
  13.     | IncrementCounter
  14.     | Mdl (Material.Msg Msg)
  15.  
  16.  
  17. update : Msg -> Model -> ( Model, Cmd Msg )
  18. update msg model =
  19.     case msg of
  20.         Mdl msg_ ->
  21.             Material.update Mdl msg_ model
  22.  
  23.         IncrementCounter ->
  24.             let
  25.                 counter =
  26.                     model.first.counter
  27.  
  28.                 first =
  29.                     model.first
  30.             in
  31.                 { model
  32.                     | globalCounter = model.globalCounter + 1
  33.                     , first = { first | counter = counter + 1 }
  34.                 }
  35.                     ! []
  36.  
  37.         _ ->
  38.             model ! []
RAW Paste Data
Top