Hermes-0.0.4: Message-based middleware layer

Network.Hermes.Misc

Description

Miscellaneous functions. Not really for public consumption.

Synopsis

Documentation

ghead :: (Data x, Typeable y) => x -> ySource

runTMVar :: TMVar s -> StateT s IO a -> IO aSource

throwM :: (MonadIO m, Exception e) => e -> m aSource

modifyTVar :: TVar a -> (a -> a) -> STM ()Source

type Type = StringSource

Our notion of types: A shown Typeable.

trapForkIO :: String -> IO () -> IO ThreadIdSource

Logs any unhandled exceptions

rsaEncrypt :: RandomGen g => g -> PublicKey -> ByteString -> (ByteString, g)Source

Encryption stuff

swap :: Ord k => k -> v -> Map k v -> (Maybe v, Map k v)Source

Swap values in a Map. Returns the old value, if any.

listenTVar :: Eq a => TVar a -> (a -> IO ()) -> IO ThreadIdSource

Executes an action once for each value of the TVar. May skip values if it changes quickly.

adjustWithDefault :: Ord k => a -> (a -> a) -> k -> Map k a -> Map k aSource