J'essaie d'utiliser Scalaz EitherT avec un scala.concurrent.Future. Lorsque vous essayez de l'utiliser dans un pour-compréhension:Instances Functor et Monad manquantes lors de l'utilisation de scala.concurrent.Future avec EitherT
import scalaz._
import Scalaz._
val et1:EitherT[Future, String, Int] = EitherT(Future.successful(1.right))
val et2:EitherT[Future, String, String] = EitherT(Future.successful("done".right))
val r:EitherT[Future, String, String] = for {
a <- et1
b <- et2
} yield (s"$a $b")
-je obtenir les instances Functor et Monad suivants manquant Erreur:
could not find implicit value for parameter F: scalaz.Functor[scala.concurrent.Future]
b <- et2
^
could not find implicit value for parameter F: scalaz.Monad[scala.concurrent.Future]
a <- et1
Est-ce que scalaz définir des instances pour Functor et Monad pour l'avenir? Sinon, y a-t-il d'autres bibliothèques qui fournissent ces instances ou dois-je les écrire?
qui ne semble pas fonctionner. – ssanj
Cela fonctionne pour moi. J'ai mis à jour ma réponse avec l'exemple complet. – danielnixon
oui, ça marche! J'ai dû manquer quelque chose quand j'ai essayé avant. Merci. – ssanj