improving documentation
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user