Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/main/scala/scalaz/Coproduct.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ sealed trait Coproduct[F[+_], G[+_], A] {
def foldMap[B](f: A => B)(implicit F: Foldable[F], G: Foldable[G], M: Monoid[B]): B =
run.fold(F.foldMap(_)(f), G.foldMap(_)(f))

def traverse[X[+_], B](g: A => X[B])(implicit F: Traverse[F], G: Traverse[G], A: Applicative[X]): X[Coproduct[F, G, B]] =
def traverse[X[_], B](g: A => X[B])(implicit F: Traverse[F], G: Traverse[G], A: Applicative[X]): X[Coproduct[F, G, B]] =
run.fold(
x => A.map(F.traverse(x)(g))(leftc(_))
, x => A.map(G.traverse(x)(g))(rightc(_))
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/scala/scalaz/Either.scala
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ sealed trait \/[+A, +B] {
bimap(f, identity)

/** Binary functor traverse on this disjunction. */
def bitraverse[F[+_]: Functor, C, D](f: A => F[C], g: B => F[D]): F[C \/ D] =
def bitraverse[F[_]: Functor, C, D](f: A => F[C], g: B => F[D]): F[C \/ D] =
this match {
case -\/(a) => Functor[F].map(f(a))(-\/(_))
case \/-(b) => Functor[F].map(g(b))(\/-(_))
Expand All @@ -90,7 +90,7 @@ sealed trait \/[+A, +B] {
bimap(identity, g)

/** Traverse on the right of this disjunction. */
def traverse[F[+_]: Applicative, D](g: B => F[D]): F[A \/ D] =
def traverse[F[_]: Applicative, AA >: A, D](g: B => F[D]): F[AA \/ D] =
this match {
case -\/(a) => Applicative[F].point(-\/(a))
case \/-(b) => Functor[F].map(g(b))(\/-(_))
Expand Down Expand Up @@ -346,7 +346,7 @@ trait DisjunctionInstances2 extends DisjunctionInstances3 {
def point[A](a: => A) =
\/-(a)

def traverseImpl[G[+_] : Applicative, A, B](fa: L \/ A)(f: A => G[B]) =
def traverseImpl[G[_] : Applicative, A, B](fa: L \/ A)(f: A => G[B]) =
fa.traverse(f)

override def foldRight[A, B](fa: L \/ A, z: => B)(f: (A, => B) => B) =
Expand All @@ -372,7 +372,7 @@ trait DisjunctionInstances3 {
override def bimap[A, B, C, D](fab: A \/ B)
(f: A => C, g: B => D) = fab bimap (f, g)

def bitraverseImpl[G[+_] : Applicative, A, B, C, D](fab: A \/ B)
def bitraverseImpl[G[_] : Applicative, A, B, C, D](fab: A \/ B)
(f: A => G[C], g: B => G[D]) =
fab.bitraverse(f, g)
}
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/scala/scalaz/EitherT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ trait EitherTFunctions {
val run = a
}

def monadTell[F[+_, +_], W, A](implicit MT0: MonadTell[F, W]) = new EitherTMonadTell[F, W, A]{
def monadTell[F[_, +_], W, A](implicit MT0: MonadTell[F, W]) = new EitherTMonadTell[F, W, A]{
def MT = MT0
}

def monadListen[F[+_, +_], W, A](implicit ML0: MonadListen[F, W]) = new EitherTMonadListen[F, W, A]{
def monadListen[F[_, +_], W, A](implicit ML0: MonadListen[F, W]) = new EitherTMonadListen[F, W, A]{
def MT = ML0
}
}
Expand Down Expand Up @@ -313,7 +313,7 @@ private[scalaz] trait EitherTHoist[A] extends Hoist[({type λ[α[+_], β] = Eith
implicit def apply[M[+_] : Monad]: Monad[({type λ[α] = EitherT[M, A, α]})#λ] = EitherT.eitherTMonad
}

private[scalaz] trait EitherTMonadTell[F[+_, +_], W, A] extends MonadTell[({type λ[+α, +β] = EitherT[({type f[+x] = F[α, x]})#f, A, β]})#λ, W] with EitherTMonad[({type λ[+α] = F[W, α]})#λ, A] with EitherTHoist[A] {
private[scalaz] trait EitherTMonadTell[F[_, +_], W, A] extends MonadTell[({type λ[α, β] = EitherT[({type f[+x] = F[α, x]})#f, A, β]})#λ, W] with EitherTMonad[({type λ[+α] = F[W, α]})#λ, A] with EitherTHoist[A] {
def MT: MonadTell[F, W]

implicit def F = MT
Expand All @@ -328,7 +328,7 @@ private[scalaz] trait EitherTMonadTell[F[+_, +_], W, A] extends MonadTell[({type
EitherT.right[({type λ[+α] = F[W, α]})#λ, A, B](MT.point(v))
}

private[scalaz] trait EitherTMonadListen[F[+_, +_], W, A] extends MonadListen[({type λ[+α, +β] = EitherT[({type f[+x] = F[α, x]})#f, A, β]})#λ, W] with EitherTMonadTell[F, W, A] {
private[scalaz] trait EitherTMonadListen[F[_, +_], W, A] extends MonadListen[({type λ[α, β] = EitherT[({type f[+x] = F[α, x]})#f, A, β]})#λ, W] with EitherTMonadTell[F, W, A] {
implicit def MT: MonadListen[F, W]

def listen[B](ma: EitherT[({type λ[+α] = F[W, α]})#λ, A, B]): EitherT[({type λ[+α] = F[W, α]})#λ, A, (B, W)] = {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/scalaz/MonadTell.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ trait MonadTell[F[_, _], W] extends Monad[({type λ[+α] = F[W, α]})#λ] {
}

object MonadTell {
def apply[F[+_, +_], W](implicit F: MonadTell[F, W]) = F
def apply[F[_, _], W](implicit F: MonadTell[F, W]) = F
}
8 changes: 4 additions & 4 deletions core/src/main/scala/scalaz/OptionT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ trait OptionTFunctions {
def apply[A](a: M[Option[A]]) = new OptionT[M, A](a)
}

def monadTell[F[+_, +_], W, A](implicit MT0: MonadTell[F, W]) = new OptionTMonadTell[F, W] {
def monadTell[F[_, +_], W, A](implicit MT0: MonadTell[F, W]) = new OptionTMonadTell[F, W] {
def MT = MT0
}

def monadListen[F[+_, +_], W, A](implicit ML0: MonadListen[F, W]) = new OptionTMonadListen[F, W] {
def monadListen[F[_, +_], W, A](implicit ML0: MonadListen[F, W]) = new OptionTMonadListen[F, W] {
def MT = ML0
}
}
Expand Down Expand Up @@ -180,7 +180,7 @@ private[scalaz] trait OptionTMonadPlus[F[+_]] extends MonadPlus[({type λ[α] =
def plus[A](a: OptionT[F, A], b: => OptionT[F, A]): OptionT[F, A] = a orElse b
}

private[scalaz] trait OptionTMonadTell[F[+_, +_], W] extends MonadTell[({ type λ[+α, +β] = OptionT[({ type f[+x] = F[α, x] })#f, β] })#λ, W] with OptionTMonad[({ type λ[+α] = F[W, α] })#λ] with OptionTHoist {
private[scalaz] trait OptionTMonadTell[F[_, +_], W] extends MonadTell[({ type λ[α, β] = OptionT[({ type f[+x] = F[α, x] })#f, β] })#λ, W] with OptionTMonad[({ type λ[+α] = F[W, α] })#λ] with OptionTHoist {
def MT: MonadTell[F, W]

implicit def F = MT
Expand All @@ -195,7 +195,7 @@ private[scalaz] trait OptionTMonadTell[F[+_, +_], W] extends MonadTell[({ type
OptionT.optionT[({ type λ[+α] = F[W, α] })#λ].apply[A](MT.point(None))
}

private[scalaz] trait OptionTMonadListen[F[+_, +_], W] extends MonadListen[({ type λ[+α, +β] = OptionT[({ type f[+x] = F[α, x] })#f, β] })#λ, W] with OptionTMonadTell[F, W] {
private[scalaz] trait OptionTMonadListen[F[_, +_], W] extends MonadListen[({ type λ[α, β] = OptionT[({ type f[+x] = F[α, x] })#f, β] })#λ, W] with OptionTMonadTell[F, W] {
def MT: MonadListen[F, W]

def listen[A](ma: OptionT[({ type λ[+α] = F[W, α] })#λ, A]): OptionT[({ type λ[+α] = F[W, α] })#λ, (A, W)] = {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/scalaz/Traverse.scala
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ trait Traverse[F[_]] extends Functor[F] with Foldable[F] { self =>
traverseS(fa)(f)(s)

/** Traverse `fa` with a `State[S, G[B]]`, internally using a `Trampoline` to avoid stack overflow. */
def traverseSTrampoline[S, G[+_] : Applicative, A, B](fa: F[A])(f: A => State[S, G[B]]): State[S, G[F[B]]] = {
def traverseSTrampoline[S, G[_] : Applicative, A, B](fa: F[A])(f: A => State[S, G[B]]): State[S, G[F[B]]] = {
import Free._
implicit val A = StateT.stateTMonadState[S, Trampoline].compose(Applicative[G])
State[S, G[F[B]]](s => {
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/scalaz/UnwriterT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ sealed trait UnwriterT[F[+_], +U, +A] { self =>
F.map(z)(wb => (wa._1, wb._2))
})

def traverse[G[+_] , B](f: A => G[B])(implicit G: Applicative[G], F: Traverse[F]): G[UnwriterT[F, U, B]] = {
def traverse[G[_] , UU >: U, B](f: A => G[B])(implicit G: Applicative[G], F: Traverse[F]): G[UnwriterT[F, UU, B]] = {
G.map(F.traverse(run){
case (w, a) => G.map(f(a))(b => (w, b))
})(UnwriterT(_))
Expand Down Expand Up @@ -200,7 +200,7 @@ private[scalaz] trait UnwriterTFoldable[F[+_], W] extends Foldable.FromFoldr[({t
private[scalaz] trait UnwriterTTraverse[F[+_], W] extends Traverse[({type λ[+α]=UnwriterT[F, W, α]})#λ] with UnwriterTFoldable[F, W] {
implicit def F: Traverse[F]

def traverseImpl[G[+_]: Applicative, A, B](fa: UnwriterT[F, W, A])(f: A => G[B]) = fa traverse f
def traverseImpl[G[_]: Applicative, A, B](fa: UnwriterT[F, W, A])(f: A => G[B]) = fa traverse f
}

private[scalaz] trait UnwriterTBifunctor[F[+_]] extends Bifunctor[({type λ[+α, +β]=UnwriterT[F, α, β]})#λ] {
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/scala/scalaz/Validation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ sealed trait Validation[+E, +A] {
bimap(f, identity)

/** Binary functor traverse on this validation. */
def bitraverse[G[+_] : Functor, C, D](f: E => G[C], g: A => G[D]): G[Validation[C, D]] = this match {
def bitraverse[G[_] : Functor, C, D](f: E => G[C], g: A => G[D]): G[Validation[C, D]] = this match {
case Failure(a) => Functor[G].map(f(a))(Failure(_))
case Success(b) => Functor[G].map(g(b))(Success(_))
}
Expand All @@ -116,7 +116,7 @@ sealed trait Validation[+E, +A] {
}

/** Traverse on the success of this validation. */
def traverse[G[+_] : Applicative, B](f: A => G[B]): G[Validation[E, B]] = this match {
def traverse[G[_] : Applicative, EE >: E, B](f: A => G[B]): G[Validation[EE, B]] = this match {
case Success(a) => Applicative[G].map(f(a))(Success(_))
case Failure(e) => Applicative[G].point(Failure(e))
}
Expand Down Expand Up @@ -400,7 +400,7 @@ trait ValidationInstances2 extends ValidationInstances3 {
override def map[A, B](fa: Validation[L, A])(f: A => B) =
fa map f

def traverseImpl[G[+_] : Applicative, A, B](fa: Validation[L, A])(f: A => G[B]) =
def traverseImpl[G[_] : Applicative, A, B](fa: Validation[L, A])(f: A => G[B]) =
fa.traverse(f)

override def foldRight[A, B](fa: Validation[L, A], z: => B)(f: (A, => B) => B) =
Expand All @@ -425,7 +425,7 @@ trait ValidationInstances3 {
override def bimap[A, B, C, D](fab: Validation[A, B])
(f: A => C, g: B => D) = fab bimap (f, g)

def bitraverseImpl[G[+_] : Applicative, A, B, C, D](fab: Validation[A, B])
def bitraverseImpl[G[_] : Applicative, A, B, C, D](fab: Validation[A, B])
(f: A => G[C], g: B => G[D]) =
fab.bitraverse(f, g)
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/scalaz/WriterT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ sealed trait WriterT[F[+_], +W, +A] { self =>
F.map(z)(wb => (s.append(wa._1, wb._1), wb._2))
})

def traverse[G[+_] , B](f: A => G[B])(implicit G: Applicative[G], F: Traverse[F]): G[WriterT[F, W, B]] = {
def traverse[G[_] , WW >: W, B](f: A => G[B])(implicit G: Applicative[G], F: Traverse[F]): G[WriterT[F, WW, B]] = {
G.map(F.traverse(run){
case (w, a) => G.map(f(a))(b => (w, b))
})(WriterT(_))
Expand Down Expand Up @@ -292,7 +292,7 @@ private[scalaz] trait WriterTFoldable[F[+_], W] extends Foldable.FromFoldr[({typ
private[scalaz] trait WriterTTraverse[F[+_], W] extends Traverse[({type λ[+α]=WriterT[F, W, α]})#λ] with WriterTFoldable[F, W] {
implicit def F: Traverse[F]

def traverseImpl[G[+_]: Applicative, A, B](fa: WriterT[F, W, A])(f: A => G[B]) = fa traverse f
def traverseImpl[G[_]: Applicative, A, B](fa: WriterT[F, W, A])(f: A => G[B]) = fa traverse f
}

private[scalaz] trait WriterTBifunctor[F[+_]] extends Bifunctor[({type λ[+α, +β]=WriterT[F, α, β]})#λ] {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/scalaz/syntax/TraverseSyntax.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ trait TraverseOps[F[_],A] extends Ops[F[A]] {
* A version of `traverse` specialized for `State[S, G[B]]` that internally uses a `Trampoline`
* to avoid stack-overflow.
*/
final def traverseSTrampoline[G[+_]: Applicative, S, B](f: A => State[S, G[B]]): State[S, G[F[B]]] =
final def traverseSTrampoline[G[_]: Applicative, S, B](f: A => State[S, G[B]]): State[S, G[F[B]]] =
F.traverseSTrampoline[S, G, A, B](self)(f)

/**
Expand Down
2 changes: 1 addition & 1 deletion effect/src/main/scala/scalaz/effect/StateTEffect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ trait StateTEffectInstances extends StateTEffectInstances0 {
trait StateTLiftIO[M[+_], S] extends LiftIO[({type λ[α] = StateT[M, S, α]})#λ] {
implicit def M: MonadIO[M]

def liftIO[A](ioa: IO[A]) = MonadTrans[({type λ[α[+_], +β] = StateT[α, S, β]})#λ].liftM(M.liftIO(ioa))
def liftIO[A](ioa: IO[A]) = MonadTrans[({type λ[α[+_], β] = StateT[α, S, β]})#λ].liftM(M.liftIO(ioa))
}