【发布时间】:2015-07-05 10:42:25
【问题描述】:
Network.accept 在接受连接时返回给我一个句柄,我将其作为参数传递给respondHTTP(来自 Network.HTTP.Base)
它们的类型是,
accept :: Socket -> IO (Handle, HostName, PortNumber)
respondHTTP :: HStream ty => HandleStream ty -> Response ty -> IO ()
这一行——git-code
handleResponse = Kleisli (print ||| respondHTTP c)
,抛出错误,
simpleserver.hs:43:53:
Couldn't match expected type ‘Network.TCP.HandleStream ty’
with actual type ‘Handle’
Relevant bindings include
handleResponse :: Kleisli IO (Either b (Response ty)) ()
(bound at simpleserver.hs:43:5)
In the first argument of ‘respondHTTP’, namely ‘c’
In the second argument of ‘(|||)’, namely ‘respondHTTP c’
如何将Handle(从Network.accept) 返回到Stream,然后再传递给respondHTTP?
【问题讨论】: