Unfortunately Scalaz 7 currently needs the type annotation here.
In a comment Yo Eight states that the type annotation will remain mandatory here. I'm not sure what his or her reasoning is, but it's in fact perfectly easy to write your own wrapper that will provide any appropriately typed tuple with a bisequence method and won't require a type annotation:
import scalaz._, std.option._, std.tuple._
class BisequenceWrapper[F[_, _]: Bitraverse, G[_]: Applicative, A, B](
v: F[G[A], G[B]]
) {
def bisequence = implicitly[Bitraverse[F]].bisequence(v)
}
implicit def bisequenceWrap[F[_, _]: Bitraverse, G[_]: Applicative, A, B](
v: F[G[A], G[B]]
) = new BisequenceWrapper(v)
Now (some(1), some("a")).bisequence will compile just fine.
I can't think of a good reason Scalaz wouldn't include something like this. Whether or not you want to add it in the meantime is a matter of taste, but there's definitely no theoretical obstacle to letting the compiler do the typing here.
You can use the fact that Scalaz 7 provides a
Bitraverse
instance for tuples and then sequence as usual (but withbisequence
instead ofsequence
):Unfortunately Scalaz 7 currently needs the type annotation here.
In a comment Yo Eight states that the type annotation will remain mandatory here. I'm not sure what his or her reasoning is, but it's in fact perfectly easy to write your own wrapper that will provide any appropriately typed tuple with a
bisequence
method and won't require a type annotation:Now
(some(1), some("a")).bisequence
will compile just fine.I can't think of a good reason Scalaz wouldn't include something like this. Whether or not you want to add it in the meantime is a matter of taste, but there's definitely no theoretical obstacle to letting the compiler do the typing here.
I realize you're asking about Scalaz, but it's worth pointing out that the standard method is not unbearably wordy:
In the general case (e.g. arbitrary-arity tuples), Shapeless is best at this sort of thing.
I think that cats version will not be redundant here.