Skip to content
This repository has been archived by the owner on Jun 15, 2020. It is now read-only.

Commit

Permalink
some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jto committed Oct 6, 2016
1 parent 3f16ef4 commit 7bb13ab
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions validation-core/src/main/scala/free/As.scala
Expand Up @@ -73,6 +73,8 @@ trait Divisible[F[_]] extends cats.functor.Contravariant[F] {
}

object Divisible {
def apply[F[_]](implicit d: Divisible[F]) = d

implicit def writeDivisible[I: cats.Monoid] =
new Divisible[Write[?, I]] {
type F[A] = Write[A, I]
Expand Down Expand Up @@ -124,8 +126,13 @@ trait Materialized[F[_]] {
}
}

def merge(implicit ap: cats.Applicative[F], lf: LeftFolder[Imps, F[HNil.type], seqH.type]) = {
val z = ap.pure(HNil)
def merge(implicit ap: cats.Applicative[F], lf: LeftFolder[Imps, F[HNil], seqH.type]) = {
val z = ap.pure(HNil: HNil)
h.foldLeft(z)(seqH)
}

def merge(implicit div: Divisible[F], rf: LeftFolder[Imps, F[HNil], seqH.type]) = {
val z = div.conquer[HNil]
h.foldLeft(z)(seqH)
}

Expand Down Expand Up @@ -159,8 +166,4 @@ trait Materialized[F[_]] {
// matD.merge2: Write[Int :: String :: Double :: HNil, JObject]
*/

def merge(implicit div: Divisible[F], rf: LeftFolder[Imps, F[HNil], seqH.type]) = {
val z = div.conquer[HNil]
h.foldLeft(z)(seqH)
}
}

0 comments on commit 7bb13ab

Please sign in to comment.