[Haskell-cafe] Having a very annoying problem related with (I think) lazy IO
shumovichy at gmail.com
Fri Dec 12 16:20:18 UTC 2014
What if you replace the `putStrLn` with `yield` or `threadDelay 1`?
Probably the loop is too fast, and it doesn't give other parts of your
program to take a lock.
On Fri, 2014-12-12 at 17:58 +0200, Ömer Sinan Ağacan wrote:
> 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.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe