object Instance
- Alphabetic
- By Inheritance
- Instance
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
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 val ApplyName: String("app")
- final val FlattenName: String("flatten")
- final val InstanceTCName: String("M")
- final val MapName: String("map")
- final val PureName: String("pure")
- implicit def applicativeInstance[A[_]](implicit ap: Applicative[A]): Aux[A]
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
- def compose[A[_], B[_]](implicit a: Aux[A], b: Aux[B]): Aux2[A, B]
-
def
contImpl[T, N[_]](c: Context, i: Instance with Singleton, convert: Convert, builder: TupleBuilder, linter: LinterDSL)(t: Either[scala.reflect.macros.blackbox.Context.Expr[T], scala.reflect.macros.blackbox.Context.Expr[(i)#M[T]]], inner: Transform[c.type, N])(implicit tt: scala.reflect.macros.blackbox.Context.WeakTypeTag[T], nt: scala.reflect.macros.blackbox.Context.WeakTypeTag[N[T]], it: scala.reflect.macros.blackbox.Context.TypeTag[i]): scala.reflect.macros.blackbox.Context.Expr[(i)#M[N[T]]]
Implementation of a macro that provides a direct syntax for applicative functors and monads.
Implementation of a macro that provides a direct syntax for applicative functors and monads. It is intended to be used in conjunction with another macro that conditions the inputs.
This method processes the Tree
t
to find inputs of the formwrap[T]( input )
This form is typically constructed by another macro that pretends to be able to get a value of typeT
from a value convertible toM[T]
. Thiswrap(input)
form has two main purposes. First, it identifies the inputs that should be transformed. Second, it allows the input trees to be wrapped for later conversion into the appropriateM[T]
type byconvert
. This wrapping is necessary because applying the first macro must preserve the original type, but it is useful to delay conversion until the outer, second macro is called. Thewrap
method accomplishes this by allowing the originalTree
andType
to be hidden behind the rawT
type. This method will remove the call towrap
so that it is not actually called at runtime.Each
input
in each expression of the formwrap[T]( input )
is transformed byconvert
. This transformation converts the input Tree to a Tree of typeM[T]
. The original wrapped expressionwrap(input)
is replaced by a reference to a new localval x: T
, wherex
is a fresh name. These converted inputs are passed tobuilder
as well as the list of these syntheticValDef
s. TheTupleBuilder
instance constructs a tuple (Tree) from the inputs and defines the right hand side of the vals that unpacks the tuple containing the results of the inputs.The constructed tuple of inputs and the code that unpacks the results of the inputs are then passed to the
i
, which is an implementation ofInstance
that is statically accessible. An Instance defines a applicative functor associated with a specific type constructor and, if it implements MonadInstance as well, a monad. Typically, it will be either a top-level module or a stable member of a top-level module (such as a val or a nested module). Thewith Singleton
part of the type verifies some cases at macro compilation time, while the full check for static accessibility is done at macro expansion time. Note: Ideally, the types would verify thati: MonadInstance
whent.isRight
. With the various dependent types involved, this is not worth it.The
t
argument is the argument of the macro that will be transformed as described above. If the macro that calls this method is for a multi-input map (app followed by map),t
should be the argument wrapped in Left. If this is for multi-input flatMap (app followed by flatMap), this should be the argument wrapped in Right. -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def idTransform[C <: Context with Singleton]: Transform[C, Types.Id]
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()