MonadZip

trait MonadZip[m: Type -> Type] with Monad[m]Source

A trait for zipping Monads, typically container monads like List.

A minimal implementation must define zipWith and zipWithA.

Signatures

def zipWith(f: a -> (b -> c \ ef), ma: m[a], mb: m[b]): m[c] \ ef with MonadZip[m] Source

Returns single monad where the element (or elements) of ma and mb are combined with the function f.

def zipWithA(f: a -> (b -> f[c] \ ef), ma: m[a], mb: m[b]): f[m[c]] \ ef with MonadZip[m], Applicative[f] Source

Generalized version of zipWith where f zips an applicative functor across the (monadic) containers ma and mb.

Trait Definitions

def unzip(mx: m[(a, b)]): (m[a], m[b]) with MonadZip[m] Source

Returns a pair of monads, the first containing the element (or elements) of the left part of mx the second containing the element (or elements) of the right part of mx.

def zip(ma: m[a], mb: m[b]): m[(a, b)] with MonadZip[m] Source