Skip to content

Instantly share code, notes, and snippets.

@retronym
Created February 5, 2012 17:51
Show Gist options
  • Save retronym/1746887 to your computer and use it in GitHub Desktop.
Save retronym/1746887 to your computer and use it in GitHub Desktop.
EitherT sequence
scala> import scalaz._, Scalaz._, effect._
import scalaz._
import Scalaz._
import effect._
scala> val listIoEither = List(EitherT[IO, Int, String](IO(Right("r"))))
listIoEither: List[scalaz.EitherT[scalaz.effect.IO,Int,String]] = List(scalaz.EitherTFunctions$$anon$20@49ab1824)
scala> val ioEitherList = listIoEither.sequenceU
ioEitherList: scalaz.EitherT[scalaz.effect.IO,Int,List[java.lang.String]] = scalaz.EitherTFunctions$$anon$20@5d38a346
scala> ioEitherList.run.unsafePerformIO
res13: Either[Int,List[java.lang.String]] = Right(List(r))