This repository has been archived on 2025-03-03. You can view files and clone it, but cannot push or open issues or pull requests.
htanks/GLDriver.hs

34 lines
No EOL
678 B
Haskell

{-# LANGUAGE ExistentialQuantification, DeriveDataTypeable #-}
module GLDriver ( Driver(..)
, Event
, SomeEvent(..)
, QuitEvent(..)
, fromEvent
) where
import Data.Typeable
class Driver a where
initialized :: a -> Bool
initGL :: a -> IO a
deinitGL :: a -> IO ()
swapBuffers :: 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
data QuitEvent = QuitEvent deriving Typeable
instance Event QuitEvent