Hello,
I'm trying to use this library with methods that are async:
In the following example, the method find() is async.
documents = Either.pure(self.database.collection.find())
Things are getting more complex when I try to use methods like fmap later on:
In this case, this is not going to work because self.database.collection.find() returns something that need to be awaited. Then, to fix the issue, I have to create 2 monads:
documents = await Either.pure(self.database.collection.find()).to_optional()
return Either.pure(documents).fmap(...)
Do you think this is how it is supposed to be used?
So I am opening this issue to have some information and best practices when it comes to mixing a monad with this kind of async way of working. Do you recommend something?
Thanks!
Hello,
I'm trying to use this library with methods that are
async:In the following example, the method
find()is async.Things are getting more complex when I try to use methods like
fmaplater on:In this case, this is not going to work because
self.database.collection.find()returns something that need to be awaited. Then, to fix the issue, I have to create 2 monads:Do you think this is how it is supposed to be used?
So I am opening this issue to have some information and best practices when it comes to mixing a monad with this kind of async way of working. Do you recommend something?
Thanks!