runServer :: IO ()
runServer = do
...
procRequests sock state
procRequests :: Socket -> State -> IO ()
procRequests sock state = do
(conn, addr) <- accept sock
newState <- updateState conn state
procRequests sock newState
where updateState probably reads/writes data to conn and returns the
updated state,
and it is tail recursive.
I found that depending on updateState I get either normal execution or
stack overflow.
I wonder if I can rely on tail IO calls being optimized and shall I
need any special directive other than -O.
On Nov 20, 3:17 pm, David Terei <davidte...@gmail.com> wrote:
> So in general I would make sure you understand why you are getting a
> stack overflow and try to fix it if simple even for -O0. Sadly its
> pretty easy to cause stack overflows at -O0 but its not a good idea to
> rely on -O1 or higher for correct behavior. That's my personal opinion
> anyway. You are pretty safe relying on GHC picking these things up
> with -O1.
>