I am starting to get more involved with haskell programming and I'd like to create a program where I can use the interactive loop in ghci to run a haskell functions that create graphics in a separate openGL window.  This would be a separate interactive window from the terminal i am running ghci in and have it's own event-loop/thread of execution.   For a very simple example, I would have a haskel function called "w = window" , which when executed would create an openGL window (inside a seprate window manager shell) and return an identifier to it.   A call to another fuinction might be "obj = cube [..] w" whch would draw an cube in the window. etc.   The openGL would have it's own event loop running to handle mouse/keyboard and refresh events which means that I would be able to manipuolate the camera with the mouse (pan, zoom, rotate etc.). This would be separate fromt he ghci input loop running in the original terminal window.

The graphics part of this is easy for me, I have this implemented in other langauges, but what i would like to do is create a functional programming environment for prototyping in 3D, so I would like to have a haskell session which I can "attach" to this 3D environment.

Any comments/feedback on the architecture/design of such a program would be appreciated.

thanks