All Downloads are FREE. Search and download functionalities are using the official Maven repository.

monocats.instances.traverse.scala Maven / Gradle / Ivy

The newest version!
package monocats.instances

import cats.{Applicative, Traverse}
import monocats.MonoTraverse
import scala.language.higherKinds

package object traverse extends TraverseInstances

trait TraverseInstances {
  implicit def monocatsTraverseInstances[F[_]: Traverse, A] =
    new TraverseMonoTraverseInstance[F, A]
}

private[instances] class TraverseMonoTraverseInstance[F[_], A](
    implicit F: Traverse[F])
    extends FoldableMonoFoldableInstance[F, A]
    with MonoTraverse[F[A]] {

  def traverse[G[_]: Applicative](fa: F[A])(f: A => G[A]): G[F[A]] =
    F.traverse(fa)(f)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy