From 414aebd6976deeb59eae9fd2c3e52ac2347c51df Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sun, 15 Oct 2023 00:33:59 +0200 Subject: [haskell] Update models for september 14th changelog --- haskell/src/SpaceTraders/Model/Waypoint.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'haskell/src/SpaceTraders/Model/Waypoint.hs') diff --git a/haskell/src/SpaceTraders/Model/Waypoint.hs b/haskell/src/SpaceTraders/Model/Waypoint.hs index b32af75..d80dc7a 100644 --- a/haskell/src/SpaceTraders/Model/Waypoint.hs +++ b/haskell/src/SpaceTraders/Model/Waypoint.hs @@ -10,19 +10,22 @@ import Data.Aeson import qualified Data.Text as T import GHC.Generics -data Waypoint = Waypoint { symbol :: T.Text +data Waypoint = Waypoint { orbits :: Maybe T.Text + , symbol :: T.Text , waypointType :: T.Text , x :: Int , y :: Int } deriving (Generic, Show) instance FromJSON Waypoint where parseJSON = withObject "Waypoint" $ \o -> - Waypoint <$> o .: "symbol" + Waypoint <$> o .:? "orbits" + <*> o .: "symbol" <*> o .: "type" <*> o .: "x" <*> o .: "y" instance ToJSON Waypoint where - toJSON (Waypoint o s t xx yy) = object [ "symbol" .= s + toJSON (Waypoint o s t xx yy) = object [ "orbits" .= o + , "symbol" .= s , "type" .= t , "x" .= xx , "y" .= yy ] -- cgit v1.2.3