add some documentation

This commit is contained in:
Greg Weber 2014-09-30 12:22:44 -07:00
parent e21bfb4d94
commit aaeafb0591

View File

@ -31,7 +31,7 @@ type KeyedTypeMap = HashMap (TypeRep, ByteString) Dynamic
-- Since 1.4.0 -- Since 1.4.0
cached :: (Monad m, Typeable a) cached :: (Monad m, Typeable a)
=> TypeMap => TypeMap
-> m a -> m a -- ^ cache the result of this action
-> m (Either (TypeMap, a) a) -- ^ Left is a cache miss, Right is a hit -> m (Either (TypeMap, a) a) -- ^ Left is a cache miss, Right is a hit
cached cache action = case clookup cache of cached cache action = case clookup cache of
Just val -> return $ Right val Just val -> return $ Right val
@ -63,7 +63,7 @@ cached cache action = case clookup cache of
cachedBy :: (Monad m, Typeable a) cachedBy :: (Monad m, Typeable a)
=> KeyedTypeMap => KeyedTypeMap
-> ByteString -> ByteString
-> m a -> m a -- ^ cache the result of this action
-> m (Either (KeyedTypeMap, a) a) -- ^ Left is a cache miss, Right is a hit -> m (Either (KeyedTypeMap, a) a) -- ^ Left is a cache miss, Right is a hit
cachedBy cache k action = case clookup k cache of cachedBy cache k action = case clookup k cache of
Just val -> return $ Right val Just val -> return $ Right val