object Ops extends Ops
- Alphabetic
- By Inheritance
- Ops
- Ops
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def binop[A, R](c: Context)(rhs: scala.reflect.macros.blackbox.Context.Expr[A]): scala.reflect.macros.blackbox.Context.Expr[R]
Given context and an expression, this method rewrites the tree to call the "desired" method with the lhs and rhs parameters.
Given context and an expression, this method rewrites the tree to call the "desired" method with the lhs and rhs parameters. We find the symbol which is applying the macro and use its name to determine what method to call.
If we see code like:
lhs + rhs
After typing and implicit resolution, we get trees like:
conversion(lhs)(ev).$plus(rhs: A): R
The macro should produce trees like:
ev.method(lhs: A, rhs: A): R
- Definition Classes
- Ops
- def binopWithEv[A, Ev, R](c: Context)(rhs: scala.reflect.macros.blackbox.Context.Expr[A])(ev: scala.reflect.macros.blackbox.Context.Expr[Ev]): scala.reflect.macros.blackbox.Context.Expr[R]
Like binop, but with ev provided to the method instead of to the implicit constructor.
- def binopWithEv2[A, Ev1, R](c: Context)(rhs: scala.reflect.macros.whitebox.Context.Expr[A])(ev1: scala.reflect.macros.whitebox.Context.Expr[Ev1]): scala.reflect.macros.whitebox.Context.Expr[R]
Like binop and binopWithEv, but there is ev provided by the implicit constructor, and ev1 provided by the method.
Like binop and binopWithEv, but there is ev provided by the implicit constructor, and ev1 provided by the method.
If we see code like:
lhs.gcd(rhs)
After typing and implicit resolution, we get trees like:
conversion(lhs)(ev: Ev).gcd(rhs)(ev1: Ev1): R
The macro should produce trees like:
ev.gcd(lhs, rhs)(ev1): R
- def binopWithLift[A, Ev, R](c: Context)(rhs: scala.reflect.macros.blackbox.Context.Expr[A])(ev1: scala.reflect.macros.blackbox.Context.Expr[Ev])(implicit arg0: scala.reflect.macros.blackbox.Context.WeakTypeTag[A]): scala.reflect.macros.blackbox.Context.Expr[R]
Combine an implicit enrichment with a lifting method.
Combine an implicit enrichment with a lifting method.
If we see code like:
lhs + 1
After typing and implicit resolution, we get trees like:
conversion(lhs)(ev0).$plus(1)(ev1): R
The macro should produce trees like:
ev0.plus(lhs, ev1.fromInt(1))
In Spire, this lets us use
Ring
's fromInt method andConvertableTo
'sfromDouble
(etc.) before applying an op. Eventually, we should generalize the way we choose the lifting method.- Definition Classes
- Ops
- def binopWithScalar[A, R](c: Context)(rhs: scala.reflect.macros.blackbox.Context.Expr[A]): scala.reflect.macros.blackbox.Context.Expr[R]
Like binop, but where the implementation comes from a child member
- def binopWithSelfLift[A, Ev, R](c: Context)(rhs: scala.reflect.macros.blackbox.Context.Expr[A])(implicit arg0: scala.reflect.macros.blackbox.Context.WeakTypeTag[A]): scala.reflect.macros.blackbox.Context.Expr[R]
This is like binopWithLift, but we use the same evidence parameter to make the method call and do the lifting.
This is like binopWithLift, but we use the same evidence parameter to make the method call and do the lifting.
If we see code like:
lhs * 2
After typing and implicit resolution, we get trees like:
conversion(lhs)(ev).$times(2): R
The macro should produce trees like:
ev.times(lhs, ev.fromInt(2))
- Definition Classes
- Ops
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def eqv[A, B](c: Context)(rhs: scala.reflect.macros.whitebox.Context.Expr[B])(ev: scala.reflect.macros.whitebox.Context.Expr[=:=[A, B]]): scala.reflect.macros.whitebox.Context.Expr[Boolean]
- def findMethodName(c: Context): scala.reflect.macros.Universe.TermName
Provide a canonical mapping between "operator names" used in
Ops
classes and the actual method names used for type classes.Provide a canonical mapping between "operator names" used in
Ops
classes and the actual method names used for type classes.It's worth noting that a particular instance of
Ops
must always map a given symbol a single method name. If you want to be able to map the same symbol to different names in different contexts, you'll need to create multipleOps
instances and configure them appropriately.In general "textual" method names should just pass through to the typeclass--it is probably not wise to provide mappings for them here.
- Definition Classes
- Ops
- def flip[A, R](c: Context)(rhs: scala.reflect.macros.blackbox.Context.Expr[A]): scala.reflect.macros.blackbox.Context.Expr[R]
Similar to binop, but for situations where there is no evidence parameter, and we just want to call a method on the rhs.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def handleBinopWithChild[A, R](c: Context)(rhs: scala.reflect.macros.blackbox.Context.Expr[A])(childName: String): scala.reflect.macros.blackbox.Context.Expr[R]
Provided to make defining things like binopWithScalar easier.
Provided to make defining things like binopWithScalar easier.
- Definition Classes
- Ops
- def handleUnopWithChild[R](c: Context)(childName: String): scala.reflect.macros.blackbox.Context.Expr[R]
- Definition Classes
- Ops
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def neqv[A, B](c: Context)(rhs: scala.reflect.macros.whitebox.Context.Expr[B])(ev: scala.reflect.macros.whitebox.Context.Expr[=:=[A, B]]): scala.reflect.macros.whitebox.Context.Expr[Boolean]
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- val operatorNames: Map[String, String]
Map of symbolic -> textual name conversions.
- def rbinop[A, R](c: Context)(lhs: scala.reflect.macros.blackbox.Context.Expr[A]): scala.reflect.macros.blackbox.Context.Expr[R]
Like binop, but for right-associative operators (eg.
- def rbinopWithEv[A, Ev, R](c: Context)(lhs: scala.reflect.macros.blackbox.Context.Expr[A])(ev: scala.reflect.macros.blackbox.Context.Expr[Ev]): scala.reflect.macros.blackbox.Context.Expr[R]
Like rbinop, but with ev provided to the method instead of to the implicit constructor.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def uesc(c: Char): String
- def unop[R](c: Context)(): scala.reflect.macros.blackbox.Context.Expr[R]
Given context, this method rewrites the tree to call the desired method with the lhs parameter.
Given context, this method rewrites the tree to call the desired method with the lhs parameter. We find the symbol which is applying the macro and use its name to determine what method to call.
If we see code like:
-lhs
After typing and implicit resolution, we get trees like:
conversion(lhs)(ev).unary_-(): R
The macro should produce trees like:
ev.negate(lhs): R
- Definition Classes
- Ops
- def unop0[R](c: Context): scala.reflect.macros.blackbox.Context.Expr[R]
A variant of unop which doesn't take an empty parameter list.
- def unopWithEv[Ev, R](c: Context)(ev: scala.reflect.macros.blackbox.Context.Expr[Ev]): scala.reflect.macros.blackbox.Context.Expr[R]
Like unop, but with ev provided to the method instead of to the implicit constructor.
- def unopWithEv2[Ev1, R](c: Context)(ev1: scala.reflect.macros.blackbox.Context.Expr[Ev1]): scala.reflect.macros.blackbox.Context.Expr[R]
Like unop and unopWithEv, but there is ev provided by the implicit constructor, and ev1 provided by the method.
Like unop and unopWithEv, but there is ev provided by the implicit constructor, and ev1 provided by the method.
If we see code like:
lhs.isId
After typing and implicit resolution, we get trees like:
conversion(lhs)(ev: Ev).isId(ev1: Ev1): R
The macro should produce trees like:
ev.isId(lhs)(ev1): R
- Definition Classes
- Ops
- def unopWithScalar[R](c: Context)(): scala.reflect.macros.blackbox.Context.Expr[R]
- Definition Classes
- Ops
- def unopWithScalar0[R](c: Context): scala.reflect.macros.blackbox.Context.Expr[R]
- Definition Classes
- Ops
- def unpack[T[_], A](c: Context): (scala.reflect.macros.Universe.Tree, scala.reflect.macros.Universe.Tree)
Given context, this method pulls the 'ev' and 'lhs' values out of instantiations of implicit -
Ops
classes.Given context, this method pulls the 'ev' and 'lhs' values out of instantiations of implicit -
Ops
classes.For instance, given a tree like:
new FooOps(x)(ev)
This method would return
(ev, x)
.- Definition Classes
- Ops
- def unpackWithoutEv(c: Context): scala.reflect.macros.Universe.Tree
Given context, this method pulls the 'lhs' value out of instantiations of implicit -
Ops
classes.Given context, this method pulls the 'lhs' value out of instantiations of implicit -
Ops
classes.For instance, given a tree like:
new FooOps(x)
This method would return
x
.- Definition Classes
- Ops
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.
Macros
Macro transformations for operators