From 125a792ec885d16fc0e41751d073caf2da9f2301 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Tue, 28 Jul 2020 23:25:57 +0200 Subject: Mess around --- client/src/Messages.elm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 client/src/Messages.elm (limited to 'client') 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" + + -- cgit v1.2.3