Created
November 19, 2015 22:00
-
-
Save brodo/6495e486648d235e10a5 to your computer and use it in GitHub Desktop.
This file contains 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
-- Actions | |
type Action = | |
NoOp | |
| PlayerList PlayerList.Action | |
| Games Games.Action | |
| Global Globals.GlobalAction | |
-- Update | |
update : Action -> Model -> Model | |
update action model = | |
case action of | |
NoOp -> | |
model | |
PlayerList act -> | |
let | |
(players, globalAction) = | |
PlayerList.update act model.playerList | |
newModel = updateGlobal globalAction model | |
in | |
{ newModel | | |
playerList <- players | |
} | |
Games act -> | |
let | |
(games, globalAction) = | |
Games.update act model.games | |
newModel = updateGlobal globalAction model | |
in | |
{ newModel | | |
games <- games | |
} | |
Global act -> | |
updateGlobal act model | |
updateGlobal : Globals.GlobalAction -> Model -> Model | |
updateGlobal action model = | |
{ model | | |
games <- Games.updateGlobal action model.games | |
, playerList <- PlayerList.updateGlobal action model.playerList | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment