My question is how does Haskell interact with the system. For example, how does IO happen?
I'm not interested in the IO monad. Or how to make Haskell print a string or read a file. I'm interested in the layer (if that's how it works) between Haskell and the underlying operating system. How does Haskell itself (not me) print anything to the console? How does it interact with the OS?
For example, in Python I can execute any system command. I can just make it do echo message
.
Where this really becomes important is understanding how sockets work, and how I can make sure that my program gets interrupted when I get a new connection.
In python, one way to do it is using epoll
which is part of the OS (and I believe just takes over control of the python process).
EDIT: as @Daniel Wagner has suggested let me make this question more specific. I am not struggling with a problem currently, I'm just theoretically curious. So let me ask you this: How does Haskell handle interrupts produced by sockets on Linux?
EDIT: And to make it easier to understand what I'm looking for in an answer: - Does Haskell stop dead in it's tracks when it gets an interrupt? - Is there any guarantees that I can answer a new connection before I can finish processing the old? - How does it get an interrupt?