mongoDB-1.0.2: Driver (client) for MongoDB, a free, scalable, fast, document DBMS

Database.MongoDB.Internal.Util

Description

Miscellaneous general functions and Show, Eq, and Ord instances for PortID

Synopsis

Documentation

class (MonadIO m, Applicative m, Functor m) => MonadIO' m Source

MonadIO with extra Applicative and Functor superclasses

Instances

shuffle :: [a] -> IO [a]Source

Randomly shuffle items in list

loop :: (Functor m, Monad m) => m (Maybe a) -> m [a]Source

Repeatedy execute action, collecting results, until it returns Nothing

untilSuccess :: (MonadError e m, Error e) => (a -> m b) -> [a] -> m bSource

Apply action to elements one at a time until one succeeds. Throw last error if all fail. Throw strMsg error if list is empty.

untilSuccess' :: MonadError e m => e -> (a -> m b) -> [a] -> m bSource

Apply action to elements one at a time until one succeeds. Throw last error if all fail. Throw given error if list is empty

whenJust :: Monad m => Maybe a -> (a -> m ()) -> m ()Source

liftIOE :: MonadIO m => (e -> e') -> ErrorT e IO a -> ErrorT e' m aSource

lift IOE monad to ErrorT monad over some MonadIO m

runIOE :: ErrorT IOError IO a -> IO aSource

Run action while catching explicit error and rethrowing in IO monad

updateAssocs :: Eq k => k -> v -> [(k, v)] -> [(k, v)]Source

Change or insert value of key in association list

bitOr :: Bits a => [a] -> aSource

bit-or all numbers together

(<.>) :: UString -> UString -> UStringSource

Concat first and second together with period in between. Eg. "hello" <.> "world" = "hello.world"

true1 :: Label -> Document -> BoolSource

Is field's value a 1 or True (MongoDB use both Int and Bools for truth values). Error if field not in document or field not a Num or Bool.

hGetN :: Handle -> Int -> IO ByteStringSource

Read N bytes from hande, blocking until all N bytes are read. If EOF is reached before N bytes then raise EOF exception.

byteStringHex :: ByteString -> StringSource

Hexadecimal string representation of a byte string. Each byte yields two hexadecimal characters.

byteHex :: Word8 -> StringSource

Two char hexadecimal representation of byte