Skip to content

Instantly share code, notes, and snippets.

@amitaibu
Created August 26, 2015 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitaibu/72607f51920be09e3370 to your computer and use it in GitHub Desktop.
Save amitaibu/72607f51920be09e3370 to your computer and use it in GitHub Desktop.
update : Action -> Model -> (Model, Effects Action)
update action model =
case action of
RequestMore ->
( model
, getRandomGif model.topic
)
NewGif maybeUrl ->
( Model model.topic (Maybe.withDefault model.gifUrl maybeUrl)
, Effects.task Tick
)
Tick ->
( model
, Effects.task (Task.sleep (5 * second)) `andThen` \_ -> NewGif)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment