From bf24c304705665953ffbbdd7f7155119a33147b2 Mon Sep 17 00:00:00 2001 From: xecarlox94 Date: Sun, 1 Dec 2024 18:16:38 +0000 Subject: [PATCH] improving documentation --- haskell/lib/API.hs | 18 +++++------------- haskell/lib/Engine.hs | 2 +- haskell/lib/JSON.hs | 13 +++++-------- haskell/lib/P2PRC.hs | 2 +- 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/haskell/lib/API.hs b/haskell/lib/API.hs index f682cd7..d8136bb 100644 --- a/haskell/lib/API.hs +++ b/haskell/lib/API.hs @@ -16,7 +16,7 @@ import Error import JSON ( IPAdressTable - , MapPortResponse + , MapPortResponse(..) , P2prcConfig ) @@ -47,19 +47,11 @@ data P2PRCapi = MkP2PRCapi } -{- | - -__Example:__ - -@ -port = 'MkMapPortRequest' 8080 \"jose.akilan.io\" -@ - --} +-- | This type defines the request required to create an association between a TCP socket port and a DNS server in the network. If successful, it makes a resource available in the network. data MapPortRequest = - MkMapPortRequest - Int -- ^ TCP socket number - String -- ^ Network domain name + MkMapPortRequest -- ^ P2PRC's port allocation request value + Int -- ^ TCP socket number + String -- ^ Network domain name {-| diff --git a/haskell/lib/Engine.hs b/haskell/lib/Engine.hs index 479fd37..c7833cf 100644 --- a/haskell/lib/Engine.hs +++ b/haskell/lib/Engine.hs @@ -17,7 +17,7 @@ import System.Process ( terminateProcess ) import API ( P2PRCapi(..) - , MapPortRequest(MkMapPortRequest) + , MapPortRequest(..) , getP2prcAPI ) diff --git a/haskell/lib/JSON.hs b/haskell/lib/JSON.hs index eecb00f..9388d69 100644 --- a/haskell/lib/JSON.hs +++ b/haskell/lib/JSON.hs @@ -15,16 +15,13 @@ import qualified Data.Text as T import Data.Aeson -{-# WARNING MapPortResponse "This newtype is unstable at the moment due to the P2PRC's library error handling bug. For more information visit: https://github.com/Akilan1999/p2p-rendering-computation/issues/114#issuecomment-2474737015" #-} +-- {-# WARNING MapPortResponse "This newtype is unstable at the moment due to the P2PRC's library error handling bug. For more information visit: https://github.com/Akilan1999/p2p-rendering-computation/issues/114#issuecomment-2474737015" #-} --- | This record type represents P2PRC's response to the TCP port and DNS address allocation. -data MapPortResponse - = MkMapPortResponse -- ^ Single data constructor - { ipAddress :: String -- ^ Column separated Host's IP address and Port - } +-- ^ This newtype represents P2PRC's response to the TCP port and DNS address allocation. This value will confirm the successful allocation and return information about it. +newtype MapPortResponse + = MkMapPortResponse -- ^ Allocation information value + String -- ^ Column separated Host's IP address and Port String deriving Show - -- , ipAddress :: IPAddress -- TODO: fix the api output - -- , port :: Int -- TODO: fix the api output diff --git a/haskell/lib/P2PRC.hs b/haskell/lib/P2PRC.hs index fc4253a..5010380 100644 --- a/haskell/lib/P2PRC.hs +++ b/haskell/lib/P2PRC.hs @@ -55,7 +55,7 @@ module P2PRC -- | These types represent the core data that is communicated between requests and the runtime. , IPAdressTable , MapPortRequest(..) - , MapPortResponse + , MapPortResponse(..) , Error(..) -- ** Type Synonyms