I just started learning Haskell. Below is some code written in an imperative style that implements a simple server -- it prints out the HTTP request headers. Besides the f
You should probably have some notion of when a message is complete. You need to read from the input handle in snippets until you recognize that you've got a complete message. Then assume everything after that is the next message. Messages might not come all at once, or might come in groups.
Messages might always be a fixed length, for example. Or terminated with \n\n
(I believe this is the case for HTTP requests)
[I may come back and post code to go with this advice, but if I don't, just try and adapt TomMD's code, which is a step in the right direction]