Last active
May 11, 2016 04:08
-
-
Save liamcurry/f6c3ea8e5ff3a1d4c0e08f2e4fee2e37 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
applyMessages : Model -> List Msg -> ( Model, Cmd Msg ) | |
applyMessages model msgs = | |
let | |
reduce : Msg -> ( Model, List (Cmd Msg) ) -> ( Model, List (Cmd Msg) ) | |
reduce msg ( oldModel, cmds ) = | |
let | |
( newModel, cmd ) = | |
update msg oldModel | |
in | |
( newModel, cmd :: cmds ) | |
results : ( Model, List (Cmd Msg) ) | |
results = | |
List.foldl reduce ( model, [] ) msgs | |
in | |
( results |> fst | |
, results |> snd |> Cmd.batch | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment