In Database.MongoDB.Query, there is this function:
access :: MonadIO m => Pipe -> AccessMode -> Database -> Action m a -> m a
The documentation says this about the function:
Run action against database on server at other end of pipe. Use access mode for any reads and writes. Return Left on connection failure or read/write failure.
- What does "return Left" mean here? I ask because
mcan be any monad (with aMonadIOinstance). For instance, what does "return Left" mean ifmis just theIOmonad? - Must
mbe theEithermonad for me to be able to detect connection or read/write failure when using theaccessmethod?
IOorMonadIO m(I suppose it makes sense if you had e.g.IO (Either a b)). Furthermore,Eithercannot be an instance ofMonadIOso you can't even instantiatemwithEither. Although,MonadIO m => EitherT e mhas an instance, but even if you use this instantiation, you will never getLeft somethingfromaccess- it's type even guarantees this. - user2407038m (Either Failure a)- it does really seem like just a case of outdated documentation. (If it's important to you, you should contact the maintainer) - user2407038