Skip to content

Instantly share code, notes, and snippets.

View salanki's full-sized avatar

Peter Salanki salanki

View GitHub Profile
@salanki
salanki / gist:8609177
Last active August 27, 2023 16:52 — forked from ceedubs/gist:8589661
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))
def union[A](a: Set[A], b: Set[A]) {
var c = b
for(item <- a) {
c += item
}
c
}
OR: