You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defoddIndices[A]:List[A] =>List[A] =
scheme.zoo.histo[ListF[A, ?], List[A], List[A]](
CVAlgebra[ListF[A, ?], List[A]] {
caseNilF=>NilcaseConsF(h, _ :<NilF) =>List(h)
caseConsF(h, _ :<ConsF(_, t :< _)) => h :: t
}
)
This fails to compile with the following error (corresponds to the ConsF(h, _ :< NilF) case):
Error:(21, 28) pattern type is incompatible with expected type;
found : qq.droste.data.list.NilF.type
required: F[qq.droste.data.Cofree[F,A]] forSome { type A; type F[_]; type F[_]; type A }
case ConsF(h, _ :< NilF) => List(h)
Apparently it can't figure out that F is ListF[A, ?] here? A workaround is to unwrap manually:
defoddIndices[A]:List[A] =>List[A] =
scheme.zoo.histo[ListF[A, ?], List[A], List[A]](
CVAlgebra[ListF[A, ?], List[A]] {
caseNilF=>NilcaseConsF(h, coa) =>Cofree.un[ListF[A, ?], List[A]](coa) match {
case (_, NilF) =>List(h)
case (_, ConsF(_, coa2)) => h ::Cofree.un[ListF[A, ?], List[A]](coa2)._1
}
}
)
The text was updated successfully, but these errors were encountered:
Consider this function (adapted from https://jtobin.io/time-traveling-recursion):
This fails to compile with the following error (corresponds to the
ConsF(h, _ :< NilF)
case):Apparently it can't figure out that
F
isListF[A, ?]
here? A workaround is to unwrap manually:The text was updated successfully, but these errors were encountered: