summaryrefslogtreecommitdiff
path: root/haskell/app
diff options
context:
space:
mode:
authorJulien Dessaux2023-10-16 23:18:38 +0200
committerJulien Dessaux2023-10-16 23:33:40 +0200
commit8c5ad1533d8278d736fed7d6cf61a7fbe0d84282 (patch)
treeb0d4228a347ac0b4fae87c2174d241a0a50100a4 /haskell/app
parent[haskell] Update models for september 14th changelog (diff)
downloadspacetraders-8c5ad1533d8278d736fed7d6cf61a7fbe0d84282.tar.gz
spacetraders-8c5ad1533d8278d736fed7d6cf61a7fbe0d84282.tar.bz2
spacetraders-8c5ad1533d8278d736fed7d6cf61a7fbe0d84282.zip
[haskell] updated main, init and server reset handling
Diffstat (limited to '')
-rw-r--r--haskell/app/Main.hs30
1 files changed, 8 insertions, 22 deletions
diff --git a/haskell/app/Main.hs b/haskell/app/Main.hs
index a7774e5..edd84cc 100644
--- a/haskell/app/Main.hs
+++ b/haskell/app/Main.hs
@@ -2,34 +2,20 @@
module Main (main) where
-import Control.Exception
-import System.Environment
-import System.Posix.Process
-
import SpaceTraders
import SpaceTraders.Automation.Init
-import SpaceTraders.APIClient.Errors
import SpaceTraders.APIClient.Ships
import SpaceTraders.APIClient.Systems
-import SpaceTraders.Database.Agents
-import SpaceTraders.Database.Contracts
-import SpaceTraders.Database.Ships
main :: IO ()
main = do
env <- initST
- runSpaceTradersT getAgent env >>= print
- s <- runSpaceTradersT initSystems env
- case s of
- Left (APIResetHappened _) -> do
- p <- getExecutablePath
- a <- getArgs
- e <- getEnvironment
- executeFile p False a (Just e)
- Left e -> throwIO e
- Right s' -> print $ length s'
- runSpaceTradersT getContracts env >>= print
- ss <- runSpaceTradersT getShips env
- runSpaceTradersT (dock $ head ss) env >>= print
- runSpaceTradersT (orbit $ head ss) env >>= print
+ runSpaceTradersT main' env
deinitST env
+ where
+ main' :: SpaceTradersT ()
+ main' = do
+ _ <- initSystems
+ (Right ships) <- myShips -- work around to fetch the initial probe
+ _ <- orbit (head ships)
+ return ()