How to use the epoll/kqueue enabled version of GHC/Haskell for network connections?

坚强是说给别人听的谎言 提交于 2020-01-14 04:24:08

问题


There is a lot of old information on the net regarding an epoll/kqueue enabled GHC. For example, the code on the Simple Servers wiki page doesn't compile anymore.

Could someone provide a basic example of how to use this feature with a modern GHC version to build, e.g. a TCP server that just responds with "Hello" on connect?


回答1:


GHC's IO manager uses epoll/kqueue under the hood without any special programmer effort. Just write the naive threaded program -- that puts each concurrent blocking IO call in a separate thread -- and GHC will make sure it works out the way you want it to.



来源:https://stackoverflow.com/questions/34031039/how-to-use-the-epoll-kqueue-enabled-version-of-ghc-haskell-for-network-connectio

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!