finishing up code issues, updated documentation
This commit is contained in:
6
Bindings/Haskell/flake.lock
generated
6
Bindings/Haskell/flake.lock
generated
@@ -79,12 +79,12 @@
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 0,
|
||||
"narHash": "sha256-SNCJZpBetNSp/V2z/ywWb11HjBWmos9uHUM+LRC4ZyI=",
|
||||
"path": "/nix/store/kf835db5hb805pmbrigx9dsq8pkdmfz6-source",
|
||||
"narHash": "sha256-f4e4JcQzBS+R+8HqJbQVeecInm2ggInJuSSymj6gtQo=",
|
||||
"path": "/nix/store/hmk8v0lxifsscll054qsdnzxqfql1998-source",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
"path": "/nix/store/kf835db5hb805pmbrigx9dsq8pkdmfz6-source",
|
||||
"path": "/nix/store/hmk8v0lxifsscll054qsdnzxqfql1998-source",
|
||||
"type": "path"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
rm -rf dist-newstyle/
|
||||
|
||||
cabal haddock
|
||||
|
||||
rm -rf ../../Docs/haskell
|
||||
|
||||
rm -rf ../Docs/haskell
|
||||
|
||||
cp -r ./dist-newstyle/build/x86_64-linux/ghc-9.6.5/p2prc-0.1.0.0/doc/html/p2prc/ ../Docs/haskell
|
||||
cp -r \
|
||||
./dist-newstyle/build/x86_64-linux/ghc-9.6.6/p2prc-0.1.0.0/doc/html/p2prc/ \
|
||||
../../Docs/haskell
|
||||
|
||||
@@ -58,31 +58,35 @@ data MapPortRequest =
|
||||
|
||||
|
||||
{-|
|
||||
This function intiates a pure P2PRC runtime state and builds up a 'P2PRCapi' API instance.
|
||||
This function intiates a pure P2PRC runtime state and builds up a 'P2PRCapi' API instance. It allows a developer to create computing orchestration algorithms using the API primitives.
|
||||
|
||||
==== __Example__
|
||||
|
||||
The following example show how this function can be used to expose the runtime functionalities:
|
||||
|
||||
@
|
||||
example :: IOEitherError P2PRCapi
|
||||
example = do
|
||||
module Main where
|
||||
|
||||
eitherP2prcAPI <- getP2prcAPI
|
||||
import P2PRC
|
||||
( p2prcAPI
|
||||
, P2PRCapi(..)
|
||||
)
|
||||
|
||||
case eitherP2prcAPI of
|
||||
( Right
|
||||
( MkP2PRCapi
|
||||
{ startServer = startServer
|
||||
, execInitConfig = execInitConfig
|
||||
, execListServers = execListServers
|
||||
, execMapPort = execMapPort
|
||||
}
|
||||
)) -> do
|
||||
main :: IO ()
|
||||
main =
|
||||
|
||||
-- Your code logic
|
||||
print "Hello P2PRC"
|
||||
|
||||
errValue -> errValue
|
||||
-- your code logic goes here
|
||||
|
||||
where
|
||||
|
||||
MkP2PRCapi
|
||||
{ startServer=startServer
|
||||
, execMapPort=execMapPort
|
||||
, execListServers=execListServers
|
||||
, execInitConfig=execInitConfig
|
||||
} = p2prcAPI
|
||||
@
|
||||
-}
|
||||
|
||||
@@ -139,6 +143,7 @@ p2prcAPI =
|
||||
execProcP2PrcParser ::
|
||||
FromJSON a =>
|
||||
[CLIOpt] -> StdInput -> IOEitherError a
|
||||
|
||||
execProcP2PrcParser = eitherExecProcessParser p2PrcCmdName
|
||||
-- TODO: GHC question, why does it scope down instead staying generic
|
||||
|
||||
|
||||
@@ -77,7 +77,6 @@ eitherExecProcess cmd opts input =
|
||||
ExitFailure i -> Left $ MkCLISystemError i cmd err
|
||||
_ -> Right out
|
||||
|
||||
|
||||
optsToCLI :: [CLIOpt] -> CLIOptsInput
|
||||
optsToCLI = concatMap _optToCLI
|
||||
where
|
||||
|
||||
@@ -60,7 +60,13 @@ import API
|
||||
runP2PRC
|
||||
:: MapPortRequest -- ^ TCP Port Request
|
||||
-> IO ()
|
||||
runP2PRC (MkMapPortRequest portNumber domainName) = let
|
||||
runP2PRC
|
||||
( MkMapPortRequest
|
||||
portNumber
|
||||
domainName
|
||||
)
|
||||
=
|
||||
let
|
||||
|
||||
--
|
||||
-- TODO: add quickcheck testing (quickchecking-dynamic)
|
||||
|
||||
Reference in New Issue
Block a user