summaryrefslogtreecommitdiff
path: root/haskell/src/SpaceTraders/Model
diff options
context:
space:
mode:
authorJulien Dessaux2023-07-02 22:58:30 +0200
committerJulien Dessaux2023-07-02 23:01:01 +0200
commita775330b4fa17fb367e55343e6fda6c7ae9e34b4 (patch)
tree8c572f799dbf434459d4659e32559c121421f120 /haskell/src/SpaceTraders/Model
parentMoved the nodejs agent to its own subfolder to make room for my haskell agent (diff)
downloadspacetraders-a775330b4fa17fb367e55343e6fda6c7ae9e34b4.tar.gz
spacetraders-a775330b4fa17fb367e55343e6fda6c7ae9e34b4.tar.bz2
spacetraders-a775330b4fa17fb367e55343e6fda6c7ae9e34b4.zip
Bootstrapped my haskell client
Diffstat (limited to '')
-rw-r--r--haskell/src/SpaceTraders/Model/Agent.hs22
1 files changed, 22 insertions, 0 deletions
diff --git a/haskell/src/SpaceTraders/Model/Agent.hs b/haskell/src/SpaceTraders/Model/Agent.hs
new file mode 100644
index 0000000..be97ac4
--- /dev/null
+++ b/haskell/src/SpaceTraders/Model/Agent.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE DeriveAnyClass #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE OverloadedStrings #-}
+
+module SpaceTraders.Model.Agent
+ ( Agent(accountId, credits, headquarters)
+ , agentSymbol
+ ) where
+
+import Data.Aeson
+import GHC.Generics
+import qualified Data.Text as T
+
+data Agent = Agent { accountId :: T.Text
+ , credits :: Integer
+ , headquarters :: T.Text
+ , startingFaction :: T.Text
+ , symbol :: T.Text
+ } deriving (FromJSON, Generic, Show, ToJSON)
+
+agentSymbol :: Agent -> T.Text
+agentSymbol = symbol