Skip to content

Context functions and polymorphic function types don't work together #9686

Open
@Katrix

Description

@Katrix

Minimized code

trait UntypedLambda[E] {
  def lam(f: E => E): E
  def app(e1: E, e2: E): E
}

def lam[E](f: E => E)(using ul: UntypedLambda[E]): E = ul.lam(f)
def app[E](e1: E, e2: E)(using ul: UntypedLambda[E]): E = ul.app(e1, e2)

type WithUntypedLambda[A] = UntypedLambda[A] ?=> A

type Hoas = [A] => UntypedLambda[A] ?=> A

//Doesn't work
//val example1: Hoas = [A] => lam[A](x => lam(y => app(x, y)))

//Works
val example1: Hoas = [A] => (using tc: UntypedLambda[A]) => lam[A](x => lam(y => app(x, y)))

Expectation

This should work, as the polymorphic function still needs a value, it's just not shown to the user.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions