Skip to content

Instantly share code, notes, and snippets.

@bigjason
Last active March 31, 2016 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bigjason/240f6cfdbbedf8f4bf513f6ee76cc847 to your computer and use it in GitHub Desktop.
Save bigjason/240f6cfdbbedf8f4bf513f6ee76cc847 to your computer and use it in GitHub Desktop.
How the hell is `scala.util.Try` missing a `zip` function?
/*
This is free and unencumbered software released into the public domain.
*/
implicit class RicherTry[+T](wrapped: Try[T]) {
def zip[That](that: => Try[That]): Try[(T, That)] =
for (a <- wrapped; b <- that) yield (a, b)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment