Skip to content

[3.0.0-M3] Curried type function not working as expected #10867

Closed
@jpablo

Description

@jpablo

Minimized code

type inserts[a, as <: Tuple] <: Tuple =
  as match
    case EmptyTuple => (a *: EmptyTuple) *: EmptyTuple
    case y *: ys => (a *: y *: ys) *: Tuple.Map[inserts[a, ys], [t <: Tuple] =>> y *: t]

type inserts2[a] =  
  [as <: Tuple] =>> inserts[a, as]

type A = inserts [1, EmptyTuple]
type B = inserts2[1][EmptyTuple]

summon[A =:= ((1 *: EmptyTuple) *: EmptyTuple)]
summon[B =:= ((1 *: EmptyTuple) *: EmptyTuple)]
summon[A =:= B]

type H[t <: Tuple] = Tuple.Concat[t, EmptyTuple]

summon[H[A] =:= H[B]]

// error!
summon[Tuple.Concat[A, EmptyTuple] =:= Tuple.Concat[B, EmptyTuple]]

Output

// Cannot prove that ((1 : Int) *: EmptyTuple) *: EmptyTuple =:= Tuple.Concat[B, EmptyTuple]

Expectation

The snippet should compile.

(it compiles in 3.0.0-M2 but not in 3.0.0-M3)

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions