Update: Mr. Nemo\'s answer helped solve the problem! The code below contains the fix! See the nb False and nb True calls below.
Would the sendfile() syscall work for you? If so you can use the sendfile package.
I don't know Haskell, but "resource temporarily unavailable" is EAGAIN.
And it looks like Haskell sets its sockets to non-blocking mode by default. So if you try to read from one when there is no data, or try to write to one when its buffer is full, you will fail with EAGAIN.
Figure out how to change the sockets to blocking mode, and I bet you will solve your problem.
[update]
Alternatively, call select or poll before attempting to read or write the socket. But you still need to handle EAGAIN, because there are rare corner cases where Linux select will indicate a socket is ready when actually it isn't.