Last active
April 10, 2018 06:58
-
-
Save girishso/235290ce414a51a6be7d71e551ff4ad4 to your computer and use it in GitHub Desktop.
gameStateDecoder.elm
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
gameStateDecoder : Decode.Decoder GameState | |
gameStateDecoder = | |
Decode.map2 GameState | |
(field "board" boardDecoder) | |
(field "currentPlayer" playerDecoder) | |
gameStateEncoder : GameState -> Encode.Value | |
gameStateEncoder v = | |
Encode.object | |
[ ( "board", boardEncoder v.board ) | |
, ( "currentPlayer", playerEncoder v.currentPlayer ) | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment