Skip to content

given in for comprehension requires withFilter #12310

Closed
@scf37

Description

@scf37

Compiler version

3.0.0-RC3

Minimized code

case class Monad[A](v: A):
  def map[B](f: A => B): Monad[B] = flatMap(a => Monad(f(a)))
  def flatMap[B](f: A => Monad[B]): Monad[B] = ???

object Test {
  for
    x <- Monad(42)  // OK
  yield x
  
  for
    given x <- Monad(42) // value withFilter is not a member of Monad[A]
  yield x
}

Output

value withFilter is not a member of Monad[A]

where:    A is a type variable with constraint >: (42 : Int)

Expectation

Successful compilation

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions