Skip to content

Commit

Permalink
Merge pull request #285 from zarthross/issue/216-diverging-implicit
Browse files Browse the repository at this point in the history
Fix issue #216
  • Loading branch information
zarthross authored Feb 20, 2019
2 parents 288fbe4 + b593c27 commit 744065e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/src/main/scala/org/http4s/rho/bits/HListToFunc.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ trait MatchersHListToFunc[F[_]] {
}

/** Converter for types `FunctionN` to an `HList` */
implicit def instance[T <: HList, TR <: HList, FU, R](implicit F: Monad[F], fp: FnToProduct.Aux[FU, TR => R], rev: Reverse.Aux[T, TR], m: Lazy[ResultMatcher[F, R]]): HListToFunc[F, T, FU] = new MatcherHListToFunc[T, FU] {
override def matcher: ResultMatcher[F, R] = m.value
implicit def instance[T <: HList, TR <: HList, FU, R](implicit F: Monad[F], fp: FnToProduct.Aux[FU, TR => R], rev: Reverse.Aux[T, TR], m: ResultMatcher[F, R]): HListToFunc[F, T, FU] = new MatcherHListToFunc[T, FU] {
override def matcher: ResultMatcher[F, R] = m
override def conv(f: FU): (Request[F], T) => F[Response[F]] = (req: Request[F], h: T) => { matcher.conv(req, f.toProduct(rev(h))) }
}

/** Converter for types `FunctionN` where the first element is a `Request` to an `HList` */
implicit def instance1[T <: HList, TR <: HList, FU, R](implicit F: Monad[F], fp: FnToProduct.Aux[FU, Request[F] :: TR => R], rev: Reverse.Aux[T, TR], m: Lazy[ResultMatcher[F, R]]): HListToFunc[F, T, FU] = new MatcherHListToFunc[T, FU] {
override def matcher: ResultMatcher[F, R] = m.value
implicit def instance1[T <: HList, TR <: HList, FU, R](implicit F: Monad[F], fp: FnToProduct.Aux[FU, Request[F] :: TR => R], rev: Reverse.Aux[T, TR], m: ResultMatcher[F, R]): HListToFunc[F, T, FU] = new MatcherHListToFunc[T, FU] {
override def matcher: ResultMatcher[F, R] = m
override def conv(f: FU): (Request[F], T) => F[Response[F]] = (req: Request[F], h: T) => { matcher.conv(req, f.toProduct(req :: rev(h))) }
}

Expand Down

0 comments on commit 744065e

Please sign in to comment.