aboutsummaryrefslogtreecommitdiff
path: root/src/Protocol.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/Protocol.elm')
-rw-r--r--src/Protocol.elm24
1 files changed, 0 insertions, 24 deletions
diff --git a/src/Protocol.elm b/src/Protocol.elm
deleted file mode 100644
index 371a23a..0000000
--- a/src/Protocol.elm
+++ /dev/null
@@ -1,24 +0,0 @@
-module Protocol exposing (State, encodeState, decodeState)
-
-import Json.Decode as D
-import Json.Encode as E
-
-{- PROTOCOL -}
-
- -- for now, this is still very boring and just has one field:
-type alias State = { state : Int }
-
-encodeState : State -> String
-encodeState state =
- E.object [ ("state", E.int state.state) ]
- |> E.encode 0
-
-
-stateDecoder : D.Decoder State
-stateDecoder = D.map State (D.field "state" D.int)
-
-decodeState : String -> Maybe State
-decodeState text = case D.decodeString (D.nullable stateDecoder) text of
- Err e -> Nothing
- Ok value -> value
-