Last active
August 29, 2015 14:11
-
-
Save vmarquez/c8c59212cc47aca200c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sepSeq[A, B, F[_], G[_]](g: G[EitherT[F, A, B]])(implicit F: Monad[F], G: Foldable[G], M: MonadPlus[G]): EitherT[F, A, (G[A],G[B])] = | |
EitherT(G.foldRight(g, F.point((M.empty[A],M.empty[B])))( (a, l) => | |
for { | |
tup <- l | |
e <- a.run | |
} yield | |
e.fold(le => (M.plus(M.point(le),tup._1), tup._2), re => (tup._1, M.plus(M.point(re), tup._2))) | |
).map(_.right[A]) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks to be a type lambda issue, if I have a type alias the issue goes away.