How could I watch several files/sockets from Haskell and wait for these to become readable/writable?
Is there anything like the select/epoll/… in Haskell? Or I am forced to spawn one thread per file/socket and always use the blocking resource from within that thread?
The question is wrong: you aren’t forced to spawn one thread per file/socket and use blocking calls, you get to spawn one thread per file/socket and use blocking calls. This is the cleanest solution (in any language); the only reason to avoid it in other languages is that it’s a bit inefficient there. GHC’s threads are cheap enough, however, that it is not inefficient in Haskell. (Additionally, behind the scenes, GHC’s IO manager uses an epoll-alike to wake up threads as appropriate.)