ANN (sorta): OpenGL with extra type safety

I recently modified the hOpenGL (and GLFW) source tree to force extra type checking on its various IO actions using the -XGeneralizedNewtypeDeriving extension (see http://hackage.haskell.org/trac/ghc/ticket/736). The main motivation was for writing concurrent OpenGL applications. Here its important to know what functions contain OpenGL commands so they can be directed to the proper threads (ones with active rendering contexts). Plus it aids in partitioning work that can be offloaded or done asynchronously. The second motivation was to enforce static type checking on commands that can only be executed in certain OpenGL contexts (sending vertex data for example). As it is now, there are 3 new monads (their names will probably change): OpenGLM: the basic opengl command PrimitiveM: commands that can only be issued between begin/end() class MonadGL: commands that can be issued in any GL context Now for the big question: Does anyone care? If so, should i make it a new hackageDB package, or try to merge it into the official GL package. Ideally, it'd be nice to get some more input on the API changes, since they're more or less a rough draft as is. Also, the GLU modules were all placed in the OpenGLM monad, which is probably wrong, assuming some commands can be called between begin/end. I'll post the code later if anyone is interested. ---------------- class MonadIO m => MonadGL m instance MonadGL OpenGLM instance MonadGL PrimitiveM newtype OpenGLM a = OpenGLM (IO a) deriving (Functor, Monad, MonadIO) newtype PrimitiveM a = PrimitiveM (IO a) deriving (Functor, Monad, MonadIO)

wqeqweuqy:
I recently modified the hOpenGL (and GLFW) source tree to force extra type checking on its various IO actions using the -XGeneralizedNewtypeDeriving extension (see http://hackage.haskell.org/trac/ghc/ticket/736).
The main motivation was for writing concurrent OpenGL applications. Here its important to know what functions contain OpenGL commands so they can be directed to the proper threads (ones with active rendering contexts). Plus it aids in partitioning work that can be offloaded or done asynchronously.
The second motivation was to enforce static type checking on commands that can only be executed in certain OpenGL contexts (sending vertex data for example).
As it is now, there are 3 new monads (their names will probably change):
OpenGLM: the basic opengl command PrimitiveM: commands that can only be issued between begin/end() class MonadGL: commands that can be issued in any GL context
Now for the big question: Does anyone care? If so, should i make it a new hackageDB package, or try to merge it into the official GL package.
Yes, make a new package. Put it on hackage. Don't waste work, when it can be archived at the very least. -- Don
participants (2)
-
Don Stewart
-
Neal Alexander