attaching a ghci session to another process

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

What comes to my mind is that you could launch your program from
inside GHCi, instead of the other way round. Just write an IO ()
function that spawns a new thread for the window, graphics, input
handling and all that. Call this function from GHCi and your window
will appear. Then write some other function that communicates with
that thread through one of Haskell's thread communication mechanisms.
I am no expert on all this, so I hope this makes some kind of sense,
but maybe there is a better solution around.
Thomas
On Thu, May 28, 2009 at 22:27, Kevin Smith
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
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (2)
-
Kevin Smith
-
Thomas ten Cate