xhb-atom-cache-0.1.0.0: Atom cache for XHB

Safe HaskellNone
LanguageHaskell2010

Graphics.XHB.AtomCache

Synopsis

Documentation

data AtomId Source

Constructors

forall l . AtomLike l => AtomId l 

class (Eq l, Hashable l, Typeable l) => AtomLike l where Source

Minimal complete definition

toAtomName

newtype AtomCacheT m a Source

Constructors

AtomCacheT 

Fields

unAtomT :: StateT AtomState m a
 

seedAtoms :: (AtomLike l, Applicative m, MonadIO m) => Connection -> [l] -> AtomCacheT m a -> AtomCacheT m (Either SomeError a) Source

Preseed the atom cache with ATOMs Example: > let atoms = ["_NET_CLIENT_LIST", "_NET_NUMBER_OF_DESKTOPS"] > fromJust $ X.connect >>= c -> runAtomCacheT . seedAtoms c atoms $ mapM_ (n -> unsafeLookupAtom n >>= liftIO . print)

tryLookupAtom :: (AtomLike l, AtomCacheCtx m, MonadIO m) => Connection -> l -> m (Either SomeError ATOM) Source

Lookup AtomName in cache first, if that fails, try to fetch from the X server and put it into the cache