diff --git a/haskell/lib/P2Prc.hs b/haskell/lib/Engine.hs similarity index 93% rename from haskell/lib/P2Prc.hs rename to haskell/lib/Engine.hs index 9b710f4..ee0d232 100644 --- a/haskell/lib/P2Prc.hs +++ b/haskell/lib/Engine.hs @@ -1,9 +1,14 @@ {-# LANGUAGE OverloadedStrings #-} -module P2Prc ( runP2Prc ) where +module Engine + ( runP2PRC + ) + where + import System.Process ( terminateProcess ) + import Control.Concurrent ( threadDelay ) import API @@ -34,8 +39,8 @@ import API -- -runP2Prc :: IO () -runP2Prc = do +runP2PRC :: Int -> String -> IO () +runP2PRC portNumber domainName = do -- -- TODO: add quickcheck testing (quickchecking-dynamic) @@ -98,7 +103,7 @@ runP2Prc = do outputStr <- execListServers print outputStr - mapPortOut <- execMapPort $ MkMapPortRequest 3333 "domain" + mapPortOut <- execMapPort $ MkMapPortRequest portNumber domainName case mapPortOut of diff --git a/haskell/lib/P2PRC.hs b/haskell/lib/P2PRC.hs new file mode 100644 index 0000000..a5aaad4 --- /dev/null +++ b/haskell/lib/P2PRC.hs @@ -0,0 +1,9 @@ +module P2PRC + ( runP2PRC + ) + where + + +import Engine + ( runP2PRC + ) diff --git a/haskell/p2prc.cabal b/haskell/p2prc.cabal index db05be8..1b0228c 100644 --- a/haskell/p2prc.cabal +++ b/haskell/p2prc.cabal @@ -1,6 +1,6 @@ cabal-version: 3.0 -name: p2prc +name: p2prc -- See the Haskell package versioning policy (PVP) for standards -- guiding when and how versions should be incremented. @@ -10,9 +10,9 @@ name: p2prc -- | | | +--- code changes with no API change version: 0.1.0.0 -synopsis: p2prc haskell library +synopsis: P2PRC haskell library -description: Implements a client interface to the P2PRC networking runtime +description: Implements a client interface to the P2PRC networking runtime license: GPL-3.0-only @@ -29,29 +29,26 @@ extra-doc-files: README.md common warnings - ghc-options: -Wall + ghc-options: -Wall executable p2prc - import: warnings + import: warnings - hs-source-dirs: src + hs-source-dirs: src - main-is: Main.hs + main-is: Main.hs - -- Modules included in this executable, other than Main. - -- other-modules: Example - - other-extensions: OverloadedStrings + other-extensions: OverloadedStrings build-depends: base , p2prc - default-language: GHC2021 + default-language: GHC2021 library - import: warnings + import: warnings build-depends: base , text @@ -60,14 +57,15 @@ library , bytestring , directory - hs-source-dirs: lib + hs-source-dirs: lib - exposed-modules: P2Prc + exposed-modules: P2PRC other-modules: API + , Engine , CLI , Environment , JSON , Error - default-language: GHC2021 + default-language: GHC2021 diff --git a/haskell/src/Main.hs b/haskell/src/Main.hs index 55d6b1d..fe3d37c 100644 --- a/haskell/src/Main.hs +++ b/haskell/src/Main.hs @@ -1,9 +1,11 @@ module Main where -import P2Prc (runP2Prc) +import P2PRC + ( runP2PRC + ) main :: IO () main = - runP2Prc + runP2PRC 3333 "jose.akilan.io"