Skip to content

Instantly share code, notes, and snippets.

@markprovan
Created December 8, 2015 00:19
Show Gist options
  • Save markprovan/ecb90c1c7782101fa2db to your computer and use it in GitHub Desktop.
Save markprovan/ecb90c1c7782101fa2db to your computer and use it in GitHub Desktop.
update : Action -> Model -> Model
update action model =
case action of
Toggle seatToToggle ->
let
updateSeat seatFromModel =
if seatFromModel.seatNo == seatToToggle.seatNo then
-- Not working, compiler expects `=`
{ seatFromModel | occupied <- not seatFromModel.occupied }
-- Works
{ seatFromModel | occupied = not seatFromModel.occupied }
else seatFromModel
in
List.map updateSeat model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment