summaryrefslogtreecommitdiff
path: root/haskell/src/SpaceTraders/Model
diff options
context:
space:
mode:
Diffstat (limited to 'haskell/src/SpaceTraders/Model')
-rw-r--r--haskell/src/SpaceTraders/Model/Agent.hs17
-rw-r--r--haskell/src/SpaceTraders/Model/Cargo.hs13
-rw-r--r--haskell/src/SpaceTraders/Model/Fuel.hs13
-rw-r--r--haskell/src/SpaceTraders/Model/Inventory.hs15
-rw-r--r--haskell/src/SpaceTraders/Model/Nav.hs19
-rw-r--r--haskell/src/SpaceTraders/Model/Ship.hs27
-rw-r--r--haskell/src/SpaceTraders/Model/System.hs21
-rw-r--r--haskell/src/SpaceTraders/Model/Waypoint.hs17
8 files changed, 67 insertions, 75 deletions
diff --git a/haskell/src/SpaceTraders/Model/Agent.hs b/haskell/src/SpaceTraders/Model/Agent.hs
index 01c08a0..a03d47f 100644
--- a/haskell/src/SpaceTraders/Model/Agent.hs
+++ b/haskell/src/SpaceTraders/Model/Agent.hs
@@ -1,19 +1,18 @@
{-# LANGUAGE DeriveAnyClass #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE DeriveGeneric #-}
module SpaceTraders.Model.Agent
( Agent(..)
) where
-import Data.Aeson
-import GHC.Generics
-import qualified Data.Text as T
+import Data.Aeson
+import qualified Data.Text as T
+import GHC.Generics
-data Agent = Agent { accountId :: T.Text
- , credits :: Integer
+data Agent = Agent { accountId :: T.Text
+ , credits :: Integer
--, faction :: Faction
- , headquarters :: T.Text
+ , headquarters :: T.Text
, startingFaction :: T.Text
- , symbol :: T.Text
+ , symbol :: T.Text
} deriving (Eq, FromJSON, Generic, Show, ToJSON)
diff --git a/haskell/src/SpaceTraders/Model/Cargo.hs b/haskell/src/SpaceTraders/Model/Cargo.hs
index 126fc63..232627c 100644
--- a/haskell/src/SpaceTraders/Model/Cargo.hs
+++ b/haskell/src/SpaceTraders/Model/Cargo.hs
@@ -1,17 +1,16 @@
{-# LANGUAGE DeriveAnyClass #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE DeriveGeneric #-}
module SpaceTraders.Model.Cargo
( Cargo(..)
) where
-import Data.Aeson
-import GHC.Generics
+import Data.Aeson
+import GHC.Generics
-import SpaceTraders.Model.Inventory(Inventory)
+import SpaceTraders.Model.Inventory (Inventory)
-data Cargo = Cargo { capacity :: Int
+data Cargo = Cargo { capacity :: Int
, inventory :: [Inventory]
- , units :: Int
+ , units :: Int
} deriving (FromJSON, Generic, Show, ToJSON)
diff --git a/haskell/src/SpaceTraders/Model/Fuel.hs b/haskell/src/SpaceTraders/Model/Fuel.hs
index ca17ebb..99c4709 100644
--- a/haskell/src/SpaceTraders/Model/Fuel.hs
+++ b/haskell/src/SpaceTraders/Model/Fuel.hs
@@ -1,21 +1,20 @@
{-# LANGUAGE DeriveAnyClass #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE DeriveGeneric #-}
module SpaceTraders.Model.Fuel
( Consumed(..)
, Fuel(..)
) where
-import Data.Aeson
-import Data.Time
-import GHC.Generics
+import Data.Aeson
+import Data.Time
+import GHC.Generics
-data Consumed = Consumed { amount :: Int
+data Consumed = Consumed { amount :: Int
, timestamp :: UTCTime
} deriving (FromJSON, Generic, Show, ToJSON)
data Fuel = Fuel { capacity :: Int
, consumed :: Consumed
- , current :: Int
+ , current :: Int
} deriving (FromJSON, Generic, Show, ToJSON)
diff --git a/haskell/src/SpaceTraders/Model/Inventory.hs b/haskell/src/SpaceTraders/Model/Inventory.hs
index db74ddb..4faea52 100644
--- a/haskell/src/SpaceTraders/Model/Inventory.hs
+++ b/haskell/src/SpaceTraders/Model/Inventory.hs
@@ -1,17 +1,16 @@
{-# LANGUAGE DeriveAnyClass #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE DeriveGeneric #-}
module SpaceTraders.Model.Inventory
( Inventory(..)
) where
-import Data.Aeson
-import GHC.Generics
-import qualified Data.Text as T
+import Data.Aeson
+import qualified Data.Text as T
+import GHC.Generics
data Inventory = Inventory { description :: T.Text
- , name :: T.Text
- , symbol :: T.Text
- , units :: Int
+ , name :: T.Text
+ , symbol :: T.Text
+ , units :: Int
} deriving (FromJSON, Generic, Show, ToJSON)
diff --git a/haskell/src/SpaceTraders/Model/Nav.hs b/haskell/src/SpaceTraders/Model/Nav.hs
index 1c23ca1..8550836 100644
--- a/haskell/src/SpaceTraders/Model/Nav.hs
+++ b/haskell/src/SpaceTraders/Model/Nav.hs
@@ -1,20 +1,19 @@
{-# LANGUAGE DeriveAnyClass #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE DeriveGeneric #-}
module SpaceTraders.Model.Nav
( Nav(..)
) where
-import Data.Aeson
-import GHC.Generics
-import qualified Data.Text as T
+import Data.Aeson
+import qualified Data.Text as T
+import GHC.Generics
-import SpaceTraders.Model.Route
+import SpaceTraders.Model.Route
-data Nav = Nav { flightMode :: T.Text
- , route :: Route
- , status :: T.Text
- , systemSymbol :: T.Text
+data Nav = Nav { flightMode :: T.Text
+ , route :: Route
+ , status :: T.Text
+ , systemSymbol :: T.Text
, waypointSymbol :: T.Text
} deriving (FromJSON, Generic, Show, ToJSON)
diff --git a/haskell/src/SpaceTraders/Model/Ship.hs b/haskell/src/SpaceTraders/Model/Ship.hs
index 2ec54f1..522276c 100644
--- a/haskell/src/SpaceTraders/Model/Ship.hs
+++ b/haskell/src/SpaceTraders/Model/Ship.hs
@@ -1,34 +1,33 @@
{-# LANGUAGE DeriveAnyClass #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE DeriveGeneric #-}
module SpaceTraders.Model.Ship
( Ship(..)
) where
-import Data.Aeson
-import GHC.Generics
-import qualified Data.Text as T
+import Data.Aeson
+import qualified Data.Text as T
+import GHC.Generics
-import SpaceTraders.Model.Cargo
-import SpaceTraders.Model.Fuel
-import SpaceTraders.Model.Nav
+import SpaceTraders.Model.Cargo
+import SpaceTraders.Model.Fuel
+import SpaceTraders.Model.Nav
-data Ship = Ship { cargo :: Cargo
+data Ship = Ship { cargo :: Cargo
, cooldown :: Cooldown
--, crew :: Crew
--, engine :: Engine
--, frame :: Frame
- , fuel :: Fuel
+ , fuel :: Fuel
--, modules :: [Module]
--, mounts :: [Mount]
- , nav :: Nav
+ , nav :: Nav
--, reactor :: Reactor
--, registration :: Registration
- , symbol :: T.Text
+ , symbol :: T.Text
} deriving (FromJSON, Generic, Show, ToJSON)
-data Cooldown = Cooldown { shipSymbol :: T.Text
- , totalSeconds :: Int
+data Cooldown = Cooldown { shipSymbol :: T.Text
+ , totalSeconds :: Int
, remainingSeconds :: Int
} deriving (FromJSON, Generic, Show, ToJSON)
diff --git a/haskell/src/SpaceTraders/Model/System.hs b/haskell/src/SpaceTraders/Model/System.hs
index 0092ef5..a673b56 100644
--- a/haskell/src/SpaceTraders/Model/System.hs
+++ b/haskell/src/SpaceTraders/Model/System.hs
@@ -1,23 +1,22 @@
-{-# LANGUAGE DeriveAnyClass #-}
-{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
module SpaceTraders.Model.System
( System(..)
) where
-import Data.Aeson
-import qualified Data.Text as T
-import GHC.Generics
+import Data.Aeson
+import qualified Data.Text as T
+import GHC.Generics
-import SpaceTraders.Model.Waypoint(Waypoint)
+import SpaceTraders.Model.Waypoint (Waypoint)
data System = System { sectorSymbol :: T.Text
- , symbol :: T.Text
- , systemType :: T.Text
- , x :: Int
- , y :: Int
- , waypoints :: [Waypoint]
+ , symbol :: T.Text
+ , systemType :: T.Text
+ , x :: Int
+ , y :: Int
+ , waypoints :: [Waypoint]
--, factions :: [Faction]
} deriving (Generic, Show)
instance FromJSON System where
diff --git a/haskell/src/SpaceTraders/Model/Waypoint.hs b/haskell/src/SpaceTraders/Model/Waypoint.hs
index d80dc7a..9f0776c 100644
--- a/haskell/src/SpaceTraders/Model/Waypoint.hs
+++ b/haskell/src/SpaceTraders/Model/Waypoint.hs
@@ -1,20 +1,19 @@
-{-# LANGUAGE DeriveAnyClass #-}
-{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
module SpaceTraders.Model.Waypoint
( Waypoint(..)
) where
-import Data.Aeson
-import qualified Data.Text as T
-import GHC.Generics
+import Data.Aeson
+import qualified Data.Text as T
+import GHC.Generics
-data Waypoint = Waypoint { orbits :: Maybe T.Text
- , symbol :: T.Text
+data Waypoint = Waypoint { orbits :: Maybe T.Text
+ , symbol :: T.Text
, waypointType :: T.Text
- , x :: Int
- , y :: Int
+ , x :: Int
+ , y :: Int
} deriving (Generic, Show)
instance FromJSON Waypoint where
parseJSON = withObject "Waypoint" $ \o ->