Hello,

Unfortunately I don't have much to add.

On Wed, Mar 13, 2013 at 9:51 PM, Jesper Särnesjö <sarnesjo@gmail.com> wrote:
Hi everybody,

This started out on haskell-beginners, as a question about poor
performance for a Haskell program using OpenGL. Thanks to a few good
suggestions there, I've managed to figure out more or less what the
underlying problem is, but not its cause.

In short, I have two programs, one written in Haskell [1] and one
written in C [2], that consist of calls to the same functions, in the
same order, to the same C library, but which do not exhibit the same
behavior. Further, the Haskell program behaves differently when
compiled using GHC, and when run in GHCi. I would like to know why
this is, and how to fix it.

There are two major differences between compiled code and code run from ghci.  First, ghci always uses the threaded runtime (compiled with -threaded).  Second, optimization levels.

If you compile your program with -threaded, do you get the desired behavior (e.g. does it work the same as with ghci)?

John L.