Created
December 7, 2015 17:31
-
-
Save odoe/f9ba1e03ef419a9a9d02 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
| type Action = NoOp | |
| | UpdateModel Model | |
| | Selected String Bool | |
| | ShowMap String Bool | |
| update : Action -> Model -> Model | |
| update action model = | |
| case action of | |
| NoOp -> | |
| model | |
| UpdateModel m -> | |
| m | |
| Selected id isSelected -> | |
| let updateItem m = if m.id == id then { m | selected = isSelected } else m | |
| in | |
| { model | items = List.map updateItem model.items } | |
| ShowMap id showMap -> | |
| let updateItem m = if m.id == id then { m | showmap = showMap } else m | |
| in | |
| { model | items = List.map updateItem model.items } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment