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
import scalaz._ | |
import Scalaz._ | |
import scala.concurrent.Future | |
import scalaz.contrib.std.scalaFuture._ // typeclass instances for Scala Future | |
import scala.concurrent.ExecutionContext.Implicits.global // implicit execution context...you probably want a better one for real-world | |
type ErrorsOrT[M[+_], +A] = EitherT[M, NonEmptyList[String], A] // String could be your error type of choice | |
for { | |
thing1 <- EitherT(Future.successful(1.right)) |
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 union[A](a: Set[A], b: Set[A]) { | |
var c = b | |
for(item <- a) { | |
c += item | |
} | |
c | |
} | |
OR: |