Skip to content

Commit 87f5d73

Browse files
committed
Documented few DhtHandle' fields
1 parent 2a72fdc commit 87f5d73

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Data/DHT/Type/Handle.hs

+7
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ instance Show DhtHandle where
5353
-- | Low-level DHT handle that is used by DHT implementations, but not consumers.
5454
data DhtHandle' s h = DhtHandle'
5555
{ state :: !s
56+
-- ^ Internal state of the DHT implementation.
57+
5658
, hash :: !(s -> DhtKey -> h)
59+
-- ^ Having hash function being part of the interface allows implementation
60+
-- to decide where the hashing function is evaluated. In example, having
61+
-- @hash = const id@ will force @h = DhtKey@, and DHT implementation will
62+
-- be handling the hashing.
63+
5764
, join :: !(s -> DhtResult IO ())
5865
, leave :: !(s -> DhtResult IO ())
5966
, lookup :: !(s -> h -> DhtResult IO Encoding)

0 commit comments

Comments
 (0)