summaryrefslogtreecommitdiffstats
path: root/GLDriver.hs
blob: e527d0973d211959ad93ff8df290c73188a9cd05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{-# 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