Skip to content

Instantly share code, notes, and snippets.

@theleoborges
Last active August 29, 2015 14:04
Show Gist options
  • Save theleoborges/1d1191933f6bb11a6eaa to your computer and use it in GitHub Desktop.
Save theleoborges/1d1191933f6bb11a6eaa to your computer and use it in GitHub Desktop.
sequence, type lambdas and sequenceU
case class Error(reason: String)
val eithers: List[\/[Error, String]] = List(\/-("Ok"), -\/(Error("notOk")))
eithers.sequence
// error: could not find implicit value for parameter ev: scalaz.Leibniz.===[scalaz.\/[Error,String],G[B]]
eithers.sequence[({type λ[α] = \/[Error, α]})#λ, String]
// scalaz.\/[Error,List[String]] = -\/(Error(notOk))
eithers.sequenceU
// scalaz.\/[Error,List[String]] = -\/(Error(notOk))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment