aboutsummaryrefslogtreecommitdiff
path: root/server/lib/Cafp/Main
diff options
context:
space:
mode:
authorJasper Van der Jeugt2020-07-30 20:09:47 +0200
committerJasper Van der Jeugt2020-07-30 20:09:47 +0200
commit68588db76baaf8f2f17dd9b7f3649b09e102ea85 (patch)
tree5704809d61b4ecfb6ac40f06b1ad51e23c9d313c /server/lib/Cafp/Main
parent3b7d11c6182b8aa3d3d4f9e36c213e4eba6c8d8f (diff)
Pass black and white cards to the client
Diffstat (limited to 'server/lib/Cafp/Main')
-rw-r--r--server/lib/Cafp/Main/GenerateElmTypes.hs4
-rw-r--r--server/lib/Cafp/Main/Server.hs4
2 files changed, 5 insertions, 3 deletions
diff --git a/server/lib/Cafp/Main/GenerateElmTypes.hs b/server/lib/Cafp/Main/GenerateElmTypes.hs
index 9c72027..51376a5 100644
--- a/server/lib/Cafp/Main/GenerateElmTypes.hs
+++ b/server/lib/Cafp/Main/GenerateElmTypes.hs
@@ -10,7 +10,9 @@ import Elm.Module
main :: IO ()
main = putStrLn $ makeElmModule "Messages"
- [ DefineElm (Proxy :: Proxy GameView)
+ [ DefineElm (Proxy :: Proxy BlackCard)
+ , DefineElm (Proxy :: Proxy WhiteCard)
+ , DefineElm (Proxy :: Proxy GameView)
, DefineElm (Proxy :: Proxy ServerMessage)
, DefineElm (Proxy :: Proxy ClientMessage)
]
diff --git a/server/lib/Cafp/Main/Server.hs b/server/lib/Cafp/Main/Server.hs
index eae887e..3edf039 100644
--- a/server/lib/Cafp/Main/Server.hs
+++ b/server/lib/Cafp/Main/Server.hs
@@ -46,8 +46,8 @@ data Server = Server
readCards :: IO Cards
readCards = Cards
- <$> fmap T.lines (T.readFile "assets/black.txt")
- <*> fmap T.lines (T.readFile "assets/white.txt")
+ <$> fmap (map BlackCard . T.lines) (T.readFile "assets/black.txt")
+ <*> fmap (map WhiteCard . T.lines) (T.readFile "assets/white.txt")
newServer :: IO Server
newServer = Server <$> readCards <*> atomically (STM.newTVar HMS.empty)