finishing up code issues, updated documentation

This commit is contained in:
2025-01-11 21:03:54 +00:00
parent a0e0a8f73e
commit 084e1f4a7d
11 changed files with 57 additions and 235 deletions

View File

@@ -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"
}
},

View File

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

View File

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

View File

@@ -77,7 +77,6 @@ eitherExecProcess cmd opts input =
ExitFailure i -> Left $ MkCLISystemError i cmd err
_ -> Right out
optsToCLI :: [CLIOpt] -> CLIOptsInput
optsToCLI = concatMap _optToCLI
where

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -1,120 +0,0 @@
<div id="package-header">
<span class="caption">p2prc-0.1.0.0: P2PRC haskell library</span>
- [Contents](index.html)
- [Index](doc-index.html)
</div>
<div id="content">
<div id="module-header">
| | |
|--------------|-----------------------------------------|
| Copyright | Copyright (C) 2006-2024 John MacFarlane |
| License | GNU GPL, version 2 or above |
| Maintainer | John MacFarlane \<jgm@berkeley.edu\> |
| Stability | alpha |
| Portability | portable |
| Safe Haskell | Safe-Inferred |
| Language | GHC2021 |
P2PRC
</div>
<div id="description">
Description
<div class="doc">
This helper module exports the main writers, readers, and data structure
definitions from the Pandoc libraries.
A typical application will chain together a reader and a writer to
convert strings from one format to another. For example, the following
simple program will act as a filter converting markdown fragments to
reStructuredText, using reference-style links instead of inline links:
module Main where
import Text.Pandoc
import Data.Text (Text)
import qualified Data.Text.IO as T
mdToRST :: Text -> IO Text
mdToRST txt = runIOorExplode $
readMarkdown def txt
>>= writeRST def{ writerReferenceLinks = True }
main :: IO ()
main = do
T.getContents >>= mdToRST >>= T.putStrLn
</div>
</div>
<div id="synopsis">
Synopsis
- [runP2PRC](#v:runP2PRC) ::
[MapPortRequest](P2PRC.html#t:MapPortRequest "P2PRC") -\>
[IO]($%7Bpkgroot%7D/../../../../dcnyq1a8qi8x59n5p53d0dx42cl8hf8x-ghc-9.6.5-doc/share/doc/ghc/html/libraries/base-4.18.2.1/System-IO.html#t:IO "System.IO")
()
- <span class="keyword">data</span> [MapPortRequest](#t:MapPortRequest)
= [MkMapPortRequest](#v:MkMapPortRequest)
[Int]($%7Bpkgroot%7D/../../../../dcnyq1a8qi8x59n5p53d0dx42cl8hf8x-ghc-9.6.5-doc/share/doc/ghc/html/libraries/base-4.18.2.1/Data-Int.html#t:Int "Data.Int")
[String]($%7Bpkgroot%7D/../../../../dcnyq1a8qi8x59n5p53d0dx42cl8hf8x-ghc-9.6.5-doc/share/doc/ghc/html/libraries/base-4.18.2.1/Data-String.html#t:String "Data.String")
</div>
<div id="interface">
# Documentation
<div class="top">
<span id="v:runP2PRC" class="def">runP2PRC</span> ::
[MapPortRequest](P2PRC.html#t:MapPortRequest "P2PRC") -\>
[IO]($%7Bpkgroot%7D/../../../../dcnyq1a8qi8x59n5p53d0dx42cl8hf8x-ghc-9.6.5-doc/share/doc/ghc/html/libraries/base-4.18.2.1/System-IO.html#t:IO "System.IO")
() <a href="#v:runP2PRC" class="selflink">#</a>
<div class="doc">
Hello World
</div>
</div>
<div class="top">
<span class="keyword">data</span> <span id="t:MapPortRequest"
class="def">MapPortRequest</span>
<a href="#t:MapPortRequest" class="selflink">#</a>
<div class="subs constructors">
Constructors
| | |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|
| <span id="v:MkMapPortRequest" class="def">MkMapPortRequest</span> [Int]($%7Bpkgroot%7D/../../../../dcnyq1a8qi8x59n5p53d0dx42cl8hf8x-ghc-9.6.5-doc/share/doc/ghc/html/libraries/base-4.18.2.1/Data-Int.html#t:Int "Data.Int") [String]($%7Bpkgroot%7D/../../../../dcnyq1a8qi8x59n5p53d0dx42cl8hf8x-ghc-9.6.5-doc/share/doc/ghc/html/libraries/base-4.18.2.1/Data-String.html#t:String "Data.String") |   |
</div>
</div>
</div>
</div>
<div id="footer">
Produced by [Haddock](http://www.haskell.org/haddock/) version 2.29.2
</div>

File diff suppressed because one or more lines are too long

View File

@@ -1,30 +0,0 @@
<div id="package-header">
<span class="caption">p2prc-0.1.0.0: P2PRC haskell library</span>
- [Contents](index.html)
- [Index](doc-index.html)
</div>
<div id="content">
<div id="index">
Index
| | |
|------------------|------------------------------------------------|
| MapPortRequest | [P2PRC](P2PRC.html#t:MapPortRequest "P2PRC") |
| MkMapPortRequest | [P2PRC](P2PRC.html#v:MkMapPortRequest "P2PRC") |
| runP2PRC | [P2PRC](P2PRC.html#v:runP2PRC "P2PRC") |
</div>
</div>
<div id="footer">
Produced by [Haddock](http://www.haskell.org/haddock/) version 2.29.2
</div>

View File

@@ -1,44 +0,0 @@
<div id="package-header">
<span class="caption">p2prc-0.1.0.0: P2PRC haskell library</span>
- [Contents](index.html)
- [Index](doc-index.html)
</div>
<div id="content">
<div id="description">
# p2prc-0.1.0.0: P2PRC haskell library
<div class="doc">
Implements a client interface to the P2PRC networking runtime
</div>
</div>
<div id="module-list">
Modules
<div id="module-list">
p2prc-0.1.0.0
- <span class="module"><span class="noexpander"> </span>[P2PRC](P2PRC.html)</span>
</div>
</div>
</div>
<div id="footer">
Produced by [Haddock](http://www.haskell.org/haddock/) version 2.29.2
</div>

Binary file not shown.