Yep, Scalaz provides monad instances for tuples (prior to Tuple8 ):
import scalaz.std.anyVal._, scalaz.std.tuple._, scalaz.syntax.monad._ scala> type IntTuple[A] = (Int, A) defined type alias IntTuple scala> pair >>= (a => (a+1).point[IntTuple]) res0: (Int, String) = (2,as1) scala> for (p <- pair) yield (p + 1) res1: (Int, String) = (2,as1)
(Note that a type alias is not needed - it simply simplifies the use of point .)
source share