RenderableFunction

com.phasmidsoftware.lascala.fp.RenderableFunction
See theRenderableFunction companion object
case class RenderableFunction[R](arity: Int, w: FunctionString, cbn: List[Boolean], cs: ParamClasses)(f: Product => R)(using evidence$1: ClassTag[R]) extends Product => Try[R], Serializable

A representation of a function call. The function (func) which defines the function call is of form Product=>R where the product (tuple)

Created by scalaprof on 1/11/17.

TODO change Seq to List in definition of cbn

Type parameters

R

the ultimate return type of this RenderableFunction (must support ClassTag)

Value parameters

arity

the number of input parameters that are required to fully apply the given function (f)

cbn

a sequence of booleans, corresponding to each of the parameters of (untupled) func. If the boolean is true, then that parameter is call-by-name, i.e. a Function0[T] rather than a T.

cs

a sequence of ClassTags corresponding to the parameters to be passed to f

f

the function itself (this field is not considered in the hashCode and equals methods)

w

a human-readable representation of the function

Attributes

Companion
object
Graph
Supertypes
trait Product
trait Equals
trait Serializable
trait Product => Try[R]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def alwaysEvaluate: Boolean

XXX in practice, the only real use for this, currently, is method evaluationStyle

XXX in practice, the only real use for this, currently, is method evaluationStyle

Attributes

Returns

if true, then this function can be eagerly evaluated.

def apply(p: Product): Try[R]

Apply parameter p to this function.

Apply parameter p to this function.

NOTE: that if R is Try[S], then the result of apply will be R, not Try[R]

Value parameters

p

a Tuple

Attributes

Returns

an R wrapped in Try

def apply[T](t: T): Try[R]

Apply parameter p to this function.

Apply parameter p to this function.

Value parameters

t

a T

Attributes

Returns

the result of invoking apply(Tuple1(t))

def asFunction: () => R

Convert this RenderableFunction into a pure, parameterless function.

Convert this RenderableFunction into a pure, parameterless function.

Attributes

def callByName(): Try[R]

Method to call this RenderableFunction by name only, that's to say without any parameters. If this is a 0-arity function, then Success(r) will be returned. Otherwise, you will get a failure.

Method to call this RenderableFunction by name only, that's to say without any parameters. If this is a 0-arity function, then Success(r) will be returned. Otherwise, you will get a failure.

Attributes

def func: Product => R

Method to get the function that is the basis of this RenderableFunction

Method to get the function that is the basis of this RenderableFunction

Attributes

Returns

the function as a Product=>R

def invert[T](n: Int): RenderableFunction[R]

Invert the first n parameter positions of this RenderableFunction

Invert the first n parameter positions of this RenderableFunction

Type parameters

T

the underling type of the parameters

Value parameters

n

the number of parameters to invert

Attributes

Returns

a new RenderableFunction with the parameters inverted

def partiallyApply[T](t: Any): Try[RenderableFunction[R]]

Method to partially apply the value t to this RenderableFunction. In this context (t comes from a Parameter which is a Left[T]), then x is always a T (never a function).

Method to partially apply the value t to this RenderableFunction. In this context (t comes from a Parameter which is a Left[T]), then x is always a T (never a function).

Type parameters

T

the desired type

Value parameters

t

a value which should yield a T

Attributes

Returns

RenderableFunction[R] wrapped in Try

def partiallyApplyFunction[T](f: () => T, z: FunctionString): Try[RenderableFunction[R]]

Method to partially apply the function f to this RenderableFunction.

Method to partially apply the function f to this RenderableFunction.

CONSIDER inline this method

Type parameters

T

the return type of f

Value parameters

f

the function

z

the corresponding FunctionString

Attributes

Returns

a RenderableFunction[R] wrapped in Try

def partiallyApplyParameters(tps: Seq[Either[_, Closure[_, _]]]): Try[RenderableFunction[R]]

Method which will take this RenderableFunction and apply the given parameters, except that any Closure parameters will themselves be partiallyApplied. The result is a RenderableFunction[R] wrapped in Try.

Method which will take this RenderableFunction and apply the given parameters, except that any Closure parameters will themselves be partiallyApplied. The result is a RenderableFunction[R] wrapped in Try.

Value parameters

tps

the list of parameters

Attributes

Returns

a RenderableFunction[R] (wrapped in Try)

override def toString: String

Method to form a String (for debugging purposes) from this RenderableFunction

Method to form a String (for debugging purposes) from this RenderableFunction

NOTE that we don't show the function itself because it gives us little additional information (only the actual arity of the function)

Attributes

Returns

a String representing this object

Definition Classes
Function1 -> Any

Inherited methods

def andThen[A](g: Try[R] => A): Product => A

Composes two instances of Function1 in a new Function1, with this function applied first.

Composes two instances of Function1 in a new Function1, with this function applied first.

Type parameters

A

the result type of function g

Value parameters

g

a function R => A

Attributes

Returns

a new function f such that f(x) == g(apply(x))

Inherited from:
Function1
def compose[A](g: A => Product): A => Try[R]

Composes two instances of Function1 in a new Function1, with this function applied last.

Composes two instances of Function1 in a new Function1, with this function applied last.

Type parameters

A

the type to which function g can be applied

Value parameters

g

a function A => T1

Attributes

Returns

a new function f such that f(x) == apply(g(x))

Inherited from:
Function1
def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product