What is @noop in simulacrum in Cats

what is @noop annotation for cats. Basically, it does not accept any String aliases such as @op. This is a scala doc for him

/**
 * Annotation that may be applied to methods on a type that is annotated with `@typeclass`.
 *
 * Doing so results in the method being excluded from the generated syntax ops type.
 */
class noop() extends StaticAnnotation

I am confused by this documentation. Can someone explain to me as well as give me an example on how to use it?

Thank you very much in advance

+4
source share
1 answer

so let's say you have this type:

@typeclass trait Foo[A] {
     def bar(x: A)(y: A): A
}

you could (through the implicit syntax defined by the simulacrum) be able to write this method:

def baz[A: Foo](x: A, y: A): A = x bar y

bar @noop, , - "bar A", , A -, .

+3

Source: https://habr.com/ru/post/1606123/


All Articles