Is there any way to cast ContextFunction1 to Function1 without creating new lambda?
//fastparser has an API that can be simplified to this one:
def parse[T](parser: A => P) = ???
//I want to write my own on top of it that will look like this
def myParse[T](parser: A ?=> P) = parse[T](parser)
//but of course it doesn't compile
//due to mismatched function types so I need to rewrite it like this
def myParse[T](parser: A ?=> P) = parse[T](s => parser(using s))
//unfortunately it forces me to create another lambda
//(not sure if another instance in memory is created)
//acording to spec: https://docs.scala-lang.org/scala3/reference/contextual/context-functions-spec.html
//Context function types erase to normal function types
//but for some reason I cannot cast one to another
def myParse[T](parser: A ?=> P) = parse[T](parser.asInstanceOf[A => P])
// ^
//No given instance of type A was found for parameter of (A) ?=> P
my question is: Is there any way to cast or directly pass ContextFunction1 to parse
method?