diff options
Diffstat (limited to '')
-rw-r--r-- | haskell/app/Main.hs | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/haskell/app/Main.hs b/haskell/app/Main.hs index 1b2ccec..85b07da 100644 --- a/haskell/app/Main.hs +++ b/haskell/app/Main.hs @@ -8,29 +8,25 @@ import System.Posix.Process import SpaceTraders import SpaceTraders.Automation.Init -import SpaceTraders.APIClient.Agent(myAgent) -import SpaceTraders.APIClient.Client -import SpaceTraders.APIClient.Ships +import SpaceTraders.APIClient.Errors import SpaceTraders.APIClient.Systems +import SpaceTraders.Database.Agents +import SpaceTraders.Database.Contracts +import SpaceTraders.Database.Ships main :: IO () main = do env <- initST - ma <- runSpaceTradersT myAgent env - case ma of - Left (APIResetHappened _) -> do - p <- getExecutablePath - a <- getArgs - e <- getEnvironment - executeFile p False a (Just e) - Left e -> throwIO e - Right ma' -> print ma' - s <- runSpaceTradersT listSystems env + 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' - ships <- runSpaceTradersT listShips env - case ships of - Left e -> throwIO e - Right s' -> print $ s' + runSpaceTradersT getContracts env >>= print + runSpaceTradersT getShips env >>= print deinitST env |