From 51705b930f8408c1a3f4706d0b172eb7970f20ba Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sat, 23 Mar 2024 15:28:28 +0100 Subject: [haskell] implemented ship refueling --- haskell/app/Main.hs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'haskell/app/Main.hs') diff --git a/haskell/app/Main.hs b/haskell/app/Main.hs index 839e6cf..a8c1d29 100644 --- a/haskell/app/Main.hs +++ b/haskell/app/Main.hs @@ -5,6 +5,7 @@ import SpaceTraders.APIClient.Agent import SpaceTraders.APIClient.Contracts import SpaceTraders.APIClient.Ships import SpaceTraders.Automation.Init +import SpaceTraders.Database.Ships main :: IO () main = do @@ -15,10 +16,14 @@ main = do main' :: SpaceTradersT () main' = do -- refresh our core objects - _ <- myAgent - _ <- myContracts - (Right ships) <- myShips -- work around to fetch the initial probe + (Right _) <- myAgent + (Right _) <- myContracts + (Right _) <- myShips + -- Testing + ships <- getShips let cmdShip = head ships - (Right t) <- orbit cmdShip - liftIO $ print t + t <- refuel cmdShip + liftIO . print $ case t of + (Right r) -> "response: " ++ show r + (Left e) -> "error: " ++ show e return () -- cgit v1.2.3