effekt-lang / effekt

A language with lexical effect handlers and lightweight effect polymorphism
https://effekt-lang.org
MIT License
334 stars 24 forks source link

Dot notation doesn't work in pattern guard with pattern receiver #709

Open jiribenes opened 6 days ago

jiribenes commented 6 days ago

In this example, UFCS throws an error:

def find[A](list: List[A], elem: A) { eq: (A, A) => Bool }: Bool = list match {
  case Nil() => false
  case Cons(head, _) and head.eq(elem) => true
  //                         ^~~
  // Cannot resolve function eq, called on a value receiver.

  case _ => false
}

but if you just write eq(head, elem), it Just Works :tm:

I think this should be somewhat unambiguous as patterns can only be values as of right now, right?