Skip to content

Commit

Permalink
Temporarily add Unapply instance for 5-param type constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Itamar Ravid committed Apr 14, 2017
1 parent e0f3e01 commit c205e5a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion core/src/main/scala/cats/Unapply.scala
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private[cats] sealed abstract class Unapply2Instances extends Unapply3Instances
}
}

private[cats] sealed abstract class Unapply3Instances {
private[cats] sealed abstract class Unapply3Instances extends Unapply5Instances {

// the type we will instantiate when we find a type class instance
// for a type in the shape of a Monad Transformer with 3 type params
Expand Down Expand Up @@ -180,3 +180,20 @@ private[cats] sealed abstract class Unapply3Instances {
def subst: F[AA, BB, C] => M[C] = identity
}
}

private[cats] sealed abstract class Unapply5Instances {
// the type we will instantiate when we find a type class instance
// for a type in the shape of a Monad Transformer with 5 type params
// F[_[_], _, _, _, _] when we fix the right type
type Aux5MTRight[TC[_[_]], MA, F[_[_], _, _, _, _], AA[_], B, C, D, E] = Unapply[TC, MA] {
type M[X] = F[AA, B, C, D, X]
type A = E
}

implicit def catsUnapply5MTright[TC[_[_]], F[_[_], _, _, _, _], AA[_], B, C, D, E](implicit tc: TC[F[AA, B, C, D, ?]]): Aux5MTRight[TC, F[AA, B, C, D, E], F, AA, B, C, D, E] = new Unapply[TC, F[AA, B, C, D, E]] {
type M[X] = F[AA, B, C, D, X]
type A = E
def TC: TC[F[AA, B, C, D, ?]] = tc
def subst: F[AA, B, C, D, E] => M[A] = identity
}
}

0 comments on commit c205e5a

Please sign in to comment.