having trouble doing tuple mapping in scala 3:
type Inner[F] = F match
case Option[x] => x
val t1 = (1, 'a', true)
val t2 = t1.map[Option]([t] => (x: t) => Some(x)) // this is fine
assertEquals(t2, (Some(1), Some('a'), Some(true)))
val t3 = t2.map[Inner]([t] => (x: t) => x.asInstanceOf[Option[?]].get) // this fails with a match type error
assertEquals(t1, t3)
the match type error is the following:
[error] | Note: a match type could not be fully reduced:
[error] |
[error] | trying to reduce TupleSuite.this.Inner[t]
[error] | failed since selector t
[error] | matches none of the cases
[error] |
[error] | case Option[x] => x
[error] one error found
the first map works, but the second one does not compile. any pointer/suggestion is welcome!