improving documentation

This commit is contained in:
2024-12-01 17:40:11 +00:00
parent 5394e8a657
commit 0254bbbd43
6 changed files with 85 additions and 33 deletions

View File

@@ -34,6 +34,11 @@ import Environment ( cleanEnvironment )
{- |
Haskell API
-}
data P2PRCapi = MkP2PRCapi
{ startServer :: IOEitherError ProcessHandle
, execInitConfig :: IOEitherError P2prcConfig
@@ -57,6 +62,33 @@ data MapPortRequest =
String -- ^ Network domain name
{-|
This function cleans the previous running state (ensuring a pure P2PRC runtime state) and builds up a conditional 'P2PRCapi' instance.
__The following example show how this function can be used to expose the runtime functionalities:__
@
example :: IOEitherError P2PRCapi
example = do
eitherP2prcAPI <- getP2prcAPI
case eitherP2prcAPI of
( Right
( MkP2PRCapi
{ startServer = startServer
, execInitConfig = execInitConfig
, execListServers = execListServers
, execMapPort = execMapPort
}
)) -> do
-- Your code logic
errValue -> errValue
@
-}
{-# WARNING getP2prcAPI "This function is currently unstable since it assumes that the Haskell program is executed from the P2PRC \"haskell\" subfolder and the \"p2prc\" executable in the the root folder." #-}
getP2prcAPI :: IOEitherError P2PRCapi
getP2prcAPI = do