Skip to content

Instantly share code, notes, and snippets.

@nuttycom
Created July 4, 2012 19:21
Show Gist options
  • Save nuttycom/3049112 to your computer and use it in GitHub Desktop.
Save nuttycom/3049112 to your computer and use it in GitHub Desktop.
Wanted: List[(A, B)] => (List[A], List[B])
scala> import scalaz._
import scalaz._
scala> import scalaz.std.list._
import scalaz.std.list._
scala> import scalaz.std.tuple._
import scalaz.std.tuple._
scala> import scalaz.syntax.bitraverse._
import scalaz.syntax.bitraverse._
scala> List((1, "a"), (2, "b")).bisequence
<console>:20: error: could not find implicit value for parameter F0: scalaz.Unapply2[scalaz.Bitraverse,List[(Int, java.lang.String)]]
List((1, "a"), (2, "b")).bisequence
^
scala> List((1, "a"), (2, "b")).bisequence[List, Int, String]
<console>:20: error: could not find implicit value for parameter F0: scalaz.Unapply2[scalaz.Bitraverse,List[(Int, java.lang.String)]]
List((1, "a"), (2, "b")).bisequence[List, Int, String]
^
scala> List((1, "a"), (2, "b")).sequence
<console>:20: error: value sequence is not a member of List[(Int, java.lang.String)]
List((1, "a"), (2, "b")).sequence
^
scala> import scalaz.syntax.traverse._
import scalaz.syntax.traverse._
scala> List((1, "a"), (2, "b")).sequence
<console>:23: error: could not find implicit value for parameter ev: scalaz.Leibniz.===[(Int, java.lang.String),G[B]]
List((1, "a"), (2, "b")).sequence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment