adding todos

This commit is contained in:
2024-10-18 11:37:13 +01:00
parent a11a6be51a
commit 35b16db6b9
2 changed files with 18 additions and 8 deletions

View File

@@ -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

View File

@@ -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)