我正在尝试为界面上的记录字段编写黑线鳕。只导出了一些字段,所以我只希望记录其中的一些。我在这里阅读了文档页面:http ://www.haskell.org/haddock/doc/html/ch03s02.html#id565178
但是,我似乎无法让它发挥作用。这是我尝试编写黑线鳕的部分:
{-|
Describes a Clients connection and provides an interface for
storing data associated with the client. Each client will be given
a unique cid and are Eq if their cid's are Eq.
A ClientConn comes packaged with two functions for storing additional
information in Strings, lookup and modify. The lookup function
takes a key and returns the current value of the key or the empty
string if it has never been set. The modify function
takes a key and value and updates it such that the next call to
lookup with that key will return the value provided.
-}
data ClientConn = ClientConn { -- | The Unique ID for this client
cid :: Integer,
-- | A lookup function for this client
lookup :: (String -> IO String),
-- | A modify function for this client
modify :: (String -> String -> IO ()),
chandle :: Handle,
host :: Net.HostName,
pid :: Net.PortNumber,
msgList :: List String,
dead :: MVar Bool,
timestamp :: TimeStamp,
tid :: MVar (ThreadId, ThreadId),
lock :: MVar Lock.Lock}
数据类型的注释正确显示在生成的黑线鳕中。但是,不会生成任何记录。我希望它为 cid、查找和修改记录生成。
提前致谢!
完整的源代码可以在这里找到:https ://github.com/jcollard/simple-server/blob/master/Network/SimpleServer.hs