Created
November 16, 2015 12:05
-
-
Save eamelink/df52be4b71c76992bfa2 to your computer and use it in GitHub Desktop.
Revisions
-
eamelink created this gist
Nov 16, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ val myList = List("foo") val myFun: (String) => EitherT[Future, Exception, Int] = (in: String) => EitherT { Future { try { \/-(in.toInt) } catch { case NonFatal(e: Exception) => -\/(e) } }} // Regular traverse Traverse[List].traverse[({type G[A]=EitherT[Future,Exception,A]})#G, String, Int](myList)(myFun) // TraverseU to the rescue! Traverse[List].traverseU(myList)(myFun) // Pimpin' to the rescue! myList.traverseU(myFun)