Skip to content

Instantly share code, notes, and snippets.

@ababup1192
Created March 2, 2019 02:41
Show Gist options
  • Save ababup1192/87bc251b826e4803414d924b82e28343 to your computer and use it in GitHub Desktop.
Save ababup1192/87bc251b826e4803414d924b82e28343 to your computer and use it in GitHub Desktop.
continuousIncrementDecrement : Msg -> Int -> Model -> Model
continuousIncrementDecrement msg num currentCounter =
List.foldl (\_ cc -> update msg cc |> Tuple.first) currentCounter (List.repeat num ())
continuousIncrementDecrement : Msg -> Int -> Model -> Model
continuousIncrementDecrement msg num currentCounter =
let
nextCounter =
update msg currentCounter |> Tuple.first
in
if num == 0 then
currentCounter
else
continuousIncrementDecrement msg (num - 1) nextCounter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment