I have a code returning Future[String \/ Response]
, monad instances for both Disjunction
and Future
and function getResult: Response => [String \/ Result]
.
Now this is written with several nested functions and I want to see it as following
for {
response <- getResponse
result <- getResult(response)
} yield result // Future[String \/ Result]
As I can understand Monad transformers are using exactly for this purpose and I could do similar things if I had Option
instead of \/
. But unfortunately I couldn't found FutureT
nor DisjunctionT
(although XorT
exists for cats).
So, is it possible to write monad transformer for above purpose? May be it already exist or I don't understand something.