Skip to content

Commit

Permalink
relax ApplicativePlus#compose constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Jul 17, 2015
1 parent 4fc3068 commit b972771
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions core/src/main/scala/scalaz/ApplicativePlus.scala
Expand Up @@ -8,8 +8,8 @@ package scalaz
trait ApplicativePlus[F[_]] extends Applicative[F] with PlusEmpty[F] { self =>
////

/**The composition of ApplicativePlus `F` and `G`, `[x]F[G[x]]`, is a ApplicativePlus */
def compose[G[_]](implicit G0: ApplicativePlus[G]): ApplicativePlus[λ[α => F[G[α]]]] =
/**The composition of ApplicativePlus `F` and Applicative `G`, `[x]F[G[x]]`, is a ApplicativePlus */
override def compose[G[_]](implicit G0: Applicative[G]): ApplicativePlus[λ[α => F[G[α]]]] =
new CompositionApplicativePlus[F, G] {
implicit def F = self
implicit def G = G0
Expand Down
6 changes: 1 addition & 5 deletions core/src/main/scala/scalaz/Composition.scala
Expand Up @@ -28,24 +28,20 @@ private trait CompositionApplicative[F[_], G[_]] extends Applicative[λ[α => F[
private trait CompositionPlus[F[_], G[_]] extends Plus[λ[α => F[G[α]]]] {
implicit def F: Plus[F]

implicit def G: Plus[G]

def plus[A](a: F[G[A]], b: => F[G[A]]): F[G[A]] =
F.plus(a, b)
}

private trait CompositionPlusEmpty[F[_], G[_]] extends PlusEmpty[λ[α => F[G[α]]]] with CompositionPlus[F, G] {
implicit def F: PlusEmpty[F]

implicit def G: PlusEmpty[G]

def empty[A]: F[G[A]] = F.empty[G[A]]
}

private trait CompositionApplicativePlus[F[_], G[_]] extends ApplicativePlus[λ[α => F[G[α]]]] with CompositionApplicative[F, G] with CompositionPlusEmpty[F, G] {
implicit def F: ApplicativePlus[F]

implicit def G: ApplicativePlus[G]
implicit def G: Applicative[G]
}

private trait CompositionFoldable[F[_], G[_]] extends Foldable[λ[α => F[G[α]]]] {
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/scala/scalaz/Plus.scala
Expand Up @@ -9,10 +9,9 @@ trait Plus[F[_]] { self =>
////

/**The composition of Plus `F` and `G`, `[x]F[G[x]]`, is a Plus */
def compose[G[_]](implicit G0: Plus[G]): Plus[λ[α => F[G[α]]]] =
def compose[G[_]]: Plus[λ[α => F[G[α]]]] =
new CompositionPlus[F, G] {
implicit def F = self
implicit def G = G0
}

/**The product of Plus `F` and `G`, `[x](F[x], G[x]])`, is a Plus */
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/scala/scalaz/PlusEmpty.scala
Expand Up @@ -10,10 +10,9 @@ trait PlusEmpty[F[_]] extends Plus[F] { self =>
def empty[A]: F[A]

/**The composition of PlusEmpty `F` and `G`, `[x]F[G[x]]`, is a PlusEmpty */
def compose[G[_]](implicit G0: PlusEmpty[G]): PlusEmpty[λ[α => F[G[α]]]] =
override def compose[G[_]]: PlusEmpty[λ[α => F[G[α]]]] =
new CompositionPlusEmpty[F, G] {
implicit def F = self
implicit def G = G0
}

/**The product of PlusEmpty `F` and `G`, `[x](F[x], G[x]])`, is a PlusEmpty */
Expand Down

0 comments on commit b972771

Please sign in to comment.