summaryrefslogtreecommitdiff
path: root/haskell/app
diff options
context:
space:
mode:
authorJulien Dessaux2024-03-23 15:28:28 +0100
committerJulien Dessaux2024-03-27 15:21:37 +0100
commit51705b930f8408c1a3f4706d0b172eb7970f20ba (patch)
treed262a4617b084e3c03c647eb64c51679016700c0 /haskell/app
parent[haskell] only dock or orbit when needed (diff)
downloadspacetraders-51705b930f8408c1a3f4706d0b172eb7970f20ba.tar.gz
spacetraders-51705b930f8408c1a3f4706d0b172eb7970f20ba.tar.bz2
spacetraders-51705b930f8408c1a3f4706d0b172eb7970f20ba.zip
[haskell] implemented ship refueling
Diffstat (limited to '')
-rw-r--r--haskell/app/Main.hs15
1 files changed, 10 insertions, 5 deletions
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 ()