[Haskell-cafe] Having a very annoying problem related with (I think) lazy IO

Ömer Sinan Ağacan omeragacan at gmail.com
Fri Dec 12 15:58:43 UTC 2014

Hi all,

I'm having a horrible bug in my program: a print statement that
doesn't force any values(e.g. it just prints a static string)
effecting the behavior of the program.

I tried hard to produce a minimal example, but couldn't manage it. So
instead I'm just going to point to the source code of my program:

If I remove this print statement everything goes weird. I think when I
remove this statement some effects are not happening, or happening in
wrong times.

Here's how I'm testing the different behavior: This is a network
application and I'm creating an environment in my system and making
this program talk to another program.

I run my program 10 times without the print statement, and run 10 times with it.

Both groups produce same output in every time, but outputs of first
group and second group are different from each other. (apart from
extra prints, of course)

So this print statement effects some other things, and expected
behavior is the one happening with print statement.

I know the program is big for anyone to figure things in short amount
of time, I'm just looking for tips and pitfalls that I may be falling.
Does anyone have any ideas what I may be doing wrong? Note that the
program doesn't use any unsafe stuff.

Thanks in advance.

More information about the Haskell-Cafe mailing list