Expr
extends ObjectSupertypes
ObjectMembers
apply
[T] ( x: T ) ( implicit qctx: QuoteContext , lift: Liftable[T] ) : Expr[T]Lift a value into an expression containing the construction of that value
Lift a value into an expression containing the construction of that value
betaReduce
[T] ( expr: Expr[T] ) ( implicit qctx: QuoteContext ) : Expr[T]e.betaReduce
returns an expression that is functionally equivalent to e
,
however if e
is of the form ((y1, ..., yn) => e2)(x1, ..., xn)
then it optimize...
e.betaReduce
returns an expression that is functionally equivalent to e
,
however if e
is of the form ((y1, ..., yn) => e2)(x1, ..., xn)
then it optimizes this the top most call by returning the result of beta-reducing the application.
Otherwise returns expr
.
block
[T] ( statements: List[Expr[Any]] , expr: Expr[T] ) ( implicit qctx: QuoteContext ) : Expr[T]Returns an expression containing a block with the given statements and ending with the expresion
Given list of statements s1 :: s2 :: ... :: Nil
and an...
Returns an expression containing a block with the given statements and ending with the expresion
Given list of statements s1 :: s2 :: ... :: Nil
and an expression e
the resulting expression
will be equivalent to '{ $s1; $s2; ...; $e }
.
extension_unlift
[T] ( expr: Expr[T] ) ( implicit qctx: QuoteContext , unlift: Unliftable[T] ) : Option[T]Return the unlifted value of this expression.
Returns None
if the expression does not contain a value or contains side effects.
Otherwise returns the So...
Return the unlifted value of this expression.
Returns None
if the expression does not contain a value or contains side effects.
Otherwise returns the Some
of the value.
extension_unliftOrError
[T] ( expr: Expr[T] ) ( implicit qctx: QuoteContext , unlift: Unliftable[T] ) : TReturn the unlifted value of this expression.
Emits an error and throws if the expression does not contain a value or contains side effects. Otherwise r...
Return the unlifted value of this expression.
Emits an error and throws if the expression does not contain a value or contains side effects. Otherwise returns the value.
ofList
[T] ( xs: Seq[Expr[T]] ) ( implicit x$2: Type[T] , x$3: QuoteContext ) : Expr[List[T]]Lifts this list of expressions into an expression of a list
Transforms a list of expression
List(e1, e2, ...)
where ei: Expr[T]
to an expression equivale...
Lifts this list of expressions into an expression of a list
Transforms a list of expression
List(e1, e2, ...)
where ei: Expr[T]
to an expression equivalent to
'{ List($e1, $e2, ...) }
typed as an Expr[List[T]]
ofSeq
[T] ( xs: Seq[Expr[T]] ) ( implicit tp: Type[T] , qctx: QuoteContext ) : Expr[Seq[T]]Lifts this sequence of expressions into an expression of a sequence
Transforms a sequence of expression
Seq(e1, e2, ...)
where ei: Expr[T]
to an expressi...
Lifts this sequence of expressions into an expression of a sequence
Transforms a sequence of expression
Seq(e1, e2, ...)
where ei: Expr[T]
to an expression equivalent to
'{ Seq($e1, $e2, ...) }
typed as an Expr[Seq[T]]
ofTuple
[T] ( tup: T ) ( implicit evidence$1: IsMappedBy[T] , evidence$2: Type[T] , qctx: QuoteContext ) : Expr[InverseMap[T,Expr[T]]]Given a tuple of the form (Expr[A1], ..., Expr[An])
, outputs a tuple Expr[(A1, ..., An)]
.
Given a tuple of the form (Expr[A1], ..., Expr[An])
, outputs a tuple Expr[(A1, ..., An)]
.
ofTupleFromSeq
( seq: Seq[Expr[Any]] ) ( implicit qctx: QuoteContext ) : Expr[Tuple]Lifts this sequence of expressions into an expression of a tuple
Transforms a sequence of expression
Seq(e1, e2, ...)
where ei: Expr[Any]
to an expressio...
Lifts this sequence of expressions into an expression of a tuple
Transforms a sequence of expression
Seq(e1, e2, ...)
where ei: Expr[Any]
to an expression equivalent to
'{ ($e1, $e2, ...) }
typed as an Expr[Tuple]
summon
[T] ( implicit tpe: Type[T] ) ( implicit qctx: QuoteContext ) : Option[Expr[T]]Find an implicit of type T
in the current scope given by qctx
.
Return Some
containing the expression of the implicit or
None
if implicit resolution fail...
Find an implicit of type T
in the current scope given by qctx
.
Return Some
containing the expression of the implicit or
None
if implicit resolution failed.