Safe Haskell | None |
---|---|
Language | Haskell2010 |
A cache mapping data requests to their results. This module is provided for access to Haxl internals only; most users should not need to import it.
- data DataCache res
- empty :: DataCache res
- insert :: (Hashable (req a), Typeable (req a), Eq (req a), Show (req a), Show a) => req a -> res a -> DataCache res -> DataCache res
- insertNotShowable :: (Hashable (req a), Typeable (req a), Eq (req a)) => req a -> res a -> DataCache res -> DataCache res
- lookup :: Typeable (req a) => req a -> DataCache res -> Maybe (res a)
- showCache :: DataCache ResultVar -> IO [(TypeRep, [(String, Either SomeException String)])]
Documentation
:: (Hashable (req a), Typeable (req a), Eq (req a), Show (req a), Show a) | |
=> req a | Request |
-> res a | Result |
-> DataCache res | |
-> DataCache res |
Inserts a request-result pair into the DataCache
.
Looks up the cached result of a request.
showCache :: DataCache ResultVar -> IO [(TypeRep, [(String, Either SomeException String)])] Source
Dumps the contents of the cache, with requests and responses
converted to String
s using show
. The entries are grouped by
TypeRep
. Note that this will fail if insertNotShowable
has
been used to insert any entries.