Skip to content

Instantly share code, notes, and snippets.

@nrinaudo
Created August 1, 2024 13:02
Show Gist options
  • Save nrinaudo/5d76ad867e0f5c7039306185f8cd7cbe to your computer and use it in GitHub Desktop.
Save nrinaudo/5d76ad867e0f5c7039306185f8cd7cbe to your computer and use it in GitHub Desktop.
def test[LA, LB, RA, RB, F[_, _]](
eqA: LA =:= RA,
eqB: LB =:= RB
): (F[LA, LB] =:= F[RA, RB]) = {
// We start from F[LA, LB] and prove equality of the "left" part.
val step1: F[LA, LB] =:= F[RA, LB] = eqA.liftCo[F[_, LB]]
// We start from F[RA, LB] and prove equality of the "right" part.
val step2: F[RA, LB] =:= F[RA, RB] = eqB.liftCo[F[RA, _]]
// Composing the two yields what we want.
step1.andThen(step2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment