diff options
author | Jasper Van der Jeugt | 2020-07-28 23:25:57 +0200 |
---|---|---|
committer | Jasper Van der Jeugt | 2020-07-28 23:25:57 +0200 |
commit | 125a792ec885d16fc0e41751d073caf2da9f2301 (patch) | |
tree | 607c34616ba7b6473b5a8ab1cf22c93acf78f292 /client/src | |
parent | f9716e24c2b41cfc416e227b275e2ae15866a370 (diff) |
Mess around
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/Messages.elm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/client/src/Messages.elm b/client/src/Messages.elm new file mode 100644 index 0000000..da10d22 --- /dev/null +++ b/client/src/Messages.elm @@ -0,0 +1,24 @@ +module Messages exposing(..) + +import Json.Decode +import Json.Encode exposing (Value) +-- The following module comes from bartavelle/json-helpers +import Json.Helpers exposing (..) +import Dict exposing (Dict) +import Set exposing (Set) + + +type ServerMessage = + Welcome + +jsonDecServerMessage : Json.Decode.Decoder ( ServerMessage ) +jsonDecServerMessage = + let jsonDecDictServerMessage = Dict.fromList [("Welcome", Welcome)] + in decodeSumUnaries "ServerMessage" jsonDecDictServerMessage + +jsonEncServerMessage : ServerMessage -> Value +jsonEncServerMessage val = + case val of + Welcome -> Json.Encode.string "Welcome" + + |