From 35b16db6b930b17c1e7882a7d8e22e29c3246a11 Mon Sep 17 00:00:00 2001 From: xecarlox94 Date: Fri, 18 Oct 2024 11:37:13 +0100 Subject: [PATCH] adding todos --- haskell/app/Main.hs | 25 +++++++++++++++++-------- haskell/p2prc-haskell.cabal | 1 + 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/haskell/app/Main.hs b/haskell/app/Main.hs index 3bae81c..8ec3df3 100644 --- a/haskell/app/Main.hs +++ b/haskell/app/Main.hs @@ -3,9 +3,8 @@ module Main where -import Data.Aeson -import Data.List +import Data.Aeson import System.Process (readProcess, terminateProcess, ProcessHandle, spawnProcess) @@ -13,16 +12,24 @@ import Control.Monad (MonadPlus(mzero)) import Control.Concurrent (threadDelay) -import qualified Data.ByteString.Lazy as LB import qualified Data.ByteString.Lazy.Char8 as LBC8 -import qualified Data.Text as T +-- TODO: Use it +-- import qualified Data.Text as T + +-- TODO: create library to abstract shell and go-level logic + main :: IO () main = do + -- TODO: add IO arguments; flag to cleanup environment + + -- TODO create record with all functions needed + + -- TODO: initialise environment; perhaps cleanup state files -- outputStr <- execProcP2Prc ["-dc"] cmdOut <- getP2PrcCmd @@ -52,6 +59,7 @@ instance FromJSON IPAdressTable where +-- TODO: refactor this datatype; better definition data ServerInfo = MkServerInfo { serverInfoName :: String -- , serverInfoIp4 :: String @@ -84,13 +92,14 @@ instance FromJSON ServerInfo where parseJSON _ = mzero - sleepNSecs :: Int -> IO () sleepNSecs i = threadDelay (i * 1000000) - -execProcP2PrcParser :: FromJSON a => [String] -> IO (Either String a) +execProcP2PrcParser :: + FromJSON a => + -- TODO: add error Type + [String] -> IO (Either String a) execProcP2PrcParser opts = eitherDecode . LBC8.pack <$> execProcP2Prc opts @@ -107,5 +116,5 @@ p2prcCmd = "/home/xecarlox/Desktop/p2p-rendering-computation/p2prc" :: String getP2PrcCmd :: IO String getP2PrcCmd = do pwdOut <- readProcess "pwd" [] "" - readProcess "sed" ["s/haskell/p2prc/"] pwdOut + readProcess "sed" ["s/haskell/p2p-rendering-computation/"] pwdOut diff --git a/haskell/p2prc-haskell.cabal b/haskell/p2prc-haskell.cabal index 002f336..5eb92eb 100644 --- a/haskell/p2prc-haskell.cabal +++ b/haskell/p2prc-haskell.cabal @@ -1,4 +1,5 @@ cabal-version: 3.0 + -- The cabal-version field refers to the version of the .cabal specification, -- and can be different from the cabal-install (the tool) version and the -- Cabal (the library) version you are using. As such, the Cabal (the library)