{-# LANGUAGE ExistentialQuantification #-} module GLDriver ( GLDriver(..) , Event , SomeEvent(..) ) where import Data.Typeable class GLDriver a where initialized :: a -> Bool initGL :: a -> IO a deinitGL :: a -> IO () nextEvent :: a -> IO (Maybe SomeEvent) class Typeable a => Event a data SomeEvent = forall a. Event a => SomeEvent a fromEvent :: Event a => SomeEvent -> Maybe a fromEvent (SomeEvent a) = cast a