LambdaOps

libretto.CoreDSL.LambdaOps
trait LambdaOps

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def apply[A, B](using SourcePos)(f: LambdaContext ?=> $[A] => $[B]): A -⚬ B

Used to define a linear function A -⚬ B in a point-full style, i.e. as a lambda expression.

Used to define a linear function A -⚬ B in a point-full style, i.e. as a lambda expression.

Recall that when defining A -⚬ B, we never get a hold of a: A as a Scala value. However, by using this method we get a hold of a: $[A], a placeholder variable, and construct the result expression $[B]. This method then inspects how the input variable a: $[A] is used in the result $[B] and infers a (point-free) construction of A -⚬ B.

Attributes

Throws
NotLinearException

if the given function violates linearity, i.e. if the input variable is not used exactly once.

UnboundVariablesException

if the result expression contains free variables (from outer λs).

Concrete methods

def *[A, B](using SourcePos)(f: LambdaContext ?=> $[A] => $[B])(using Comonoid[A]): A -⚬ B
def +[A, B](using SourcePos)(f: LambdaContext ?=> $[A] => $[B])(using Cosemigroup[A]): A -⚬ B
def ?[A, B](using SourcePos)(f: LambdaContext ?=> $[A] => $[B])(using Affine[A]): A -⚬ B