class MLFunction[D, R] extends MLValue[(D) => R]
An MLValue that refers to an ML function in the Isabelle process.
This class extends MLValue[D => R]
(which by definition refers to an ML function) but provides
additional methods for invoking the function. Given an MLValue[D => R]
, you can convert it to
an MLFunction using MLValue.function.
- Source
- MLFunction.scala
- Alphabetic
- By Inheritance
- MLFunction
- MLValue
- FutureValue
- 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
- def apply(arg: D)(implicit isabelle: Isabelle, ec: ExecutionContext, converter: Converter[D]): MLValue[R]
Same as apply(MLValue[D]) but first converts
arg
into an MLValue (i.e., transfers it to the Isabelle process). - def apply(arg: MLValue[D])(implicit isabelle: Isabelle, ec: ExecutionContext): MLValue[R]
Invokes the function on a value
arg
stored in the Isabelle process.Invokes the function on a value
arg
stored in the Isabelle process.Note that the result
r
of the computation happens in a future (inside an MLValue), so exceptions in the ML code are not immediately thrown. To force exceptions, use, e.g.,r.retrieveNow
orr.force
.- returns
the function result inside an MLValue
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def await: Unit
Blocks until this future value is computed.
Blocks until this future value is computed. (Or throws an exception if the computation fails.)
- Definition Classes
- MLValue → FutureValue
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def debugInfo(implicit isabelle: Isabelle, ec: ExecutionContext): String
Returns a textual representation of the value in the ML process as it is stored in the object store (i.e., encoded as an exception).
Returns a textual representation of the value in the ML process as it is stored in the object store (i.e., encoded as an exception). E.g., an integer 3 would be represented as "E_Int 3".
- Definition Classes
- MLValue
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def force: MLFunction.this.type
Waits till the computation of this value (in the Isabelle process) has finished.
Waits till the computation of this value (in the Isabelle process) has finished. (Or until an exception is thrown.)
- returns
this value, but it is guaranteed to have completed the computation
- Definition Classes
- FutureValue
- def forceFuture(implicit ec: ExecutionContext): Future[MLFunction.this.type]
A future containing this object with the computation completed.
A future containing this object with the computation completed. In particular, if this value throws an exception upon computation, the future holds that exception.
- Definition Classes
- FutureValue
- def function[D, R](implicit ev: =:=[MLValue[(D) => R], MLValue[(D) => R]]): MLFunction[D, R]
Returns this MLValue as an MLFunction, assuming this MLValue has a type of the form
MLValue[D => R]
.Returns this MLValue as an MLFunction, assuming this MLValue has a type of the form
MLValue[D => R]
. If this MLValue isMLValue[D => R]
, it means it references a function value in the ML process. Converting it to anMLFunction <: MLValue
gives us access to additional methods for applying this function.- Definition Classes
- MLValue
- See also
- def function0[R](implicit ev: =:=[MLValue[(D) => R], MLValue[(Unit) => R]]): MLFunction0[R]
Analogous to function but for functions that take a unit-valye as argument, i.e.,
this : MLValue[Unit => R]
. - def function2[D1, D2, R](implicit ev: =:=[MLValue[(D) => R], MLValue[((D1, D2)) => R]]): MLFunction2[D1, D2, R]
Analogous to function but for functions that take a pair as argument, i.e.,
this : MLValue[((D1, D2)) => R]
. - def function3[D1, D2, D3, R](implicit ev: =:=[MLValue[(D) => R], MLValue[((D1, D2, D3)) => R]]): MLFunction3[D1, D2, D3, R]
Analogous to function but for functions that take a 3-tuple as argument, i.e.,
this : MLValue[((D1, D2, D3)) => R]
. - def function4[D1, D2, D3, D4, R](implicit ev: =:=[MLValue[(D) => R], MLValue[((D1, D2, D3, D4)) => R]]): MLFunction4[D1, D2, D3, D4, R]
Analogous to function but for functions that take a 4-tuple as argument, i.e.,
this : MLValue[((D1, D2, D3, D4)) => R]
. - def function5[D1, D2, D3, D4, D5, R](implicit ev: =:=[MLValue[(D) => R], MLValue[((D1, D2, D3, D4, D5)) => R]]): MLFunction5[D1, D2, D3, D4, D5, R]
Analogous to function but for functions that take a 5-tuple as argument, i.e.,
this : MLValue[((D1, D2, D3, D4, D5)) => R]
. - def function6[D1, D2, D3, D4, D5, D6, R](implicit ev: =:=[MLValue[(D) => R], MLValue[((D1, D2, D3, D4, D5, D6)) => R]]): MLFunction6[D1, D2, D3, D4, D5, D6, R]
Analogous to function but for functions that take a 6-tuple as argument, i.e.,
this : MLValue[((D1, D2, D3, D4, D5, D6)) => R]
. - def function7[D1, D2, D3, D4, D5, D6, D7, R](implicit ev: =:=[MLValue[(D) => R], MLValue[((D1, D2, D3, D4, D5, D6, D7)) => R]]): MLFunction7[D1, D2, D3, D4, D5, D6, D7, R]
Analogous to function but for functions that take a 7-tuple as argument, i.e.,
this : MLValue[((D1, D2, D3, D4, D5, D6, D7)) => R]
. - final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- val id: Future[ID]
- Definition Classes
- MLValue
- def insertMLValue[C[_], B](implicit ev: =:=[(D) => R, C[B]]): MLValue[C[MLValue[B]]]
Specialized type cast that inserts
MLValue[]
in arbitrary positions in the type parameter of this MLValue.Specialized type cast that inserts
MLValue[]
in arbitrary positions in the type parameter of this MLValue. E.g., we can type castthis : MLValue[List[X]]
toMLValue[List[MLValue[X]]]
by invokingthis.insertMLValue[List,X]
Such type casts are safe because the the wayMLValue[...]
is interpreted in the type parameter toMLValue
(see MLValueConverter). The same type cast could be achieved using.asInstanceOf
, butinsertMLValue
guarantees that no unsafe cast is accidentally performed.- Definition Classes
- MLValue
- Annotations
- @inline()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def logError(message: => String)(implicit executionContext: ExecutionContext): MLFunction.this.type
- Definition Classes
- MLValue
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def removeMLValue[C[_], B](implicit ev: =:=[(D) => R, C[MLValue[B]]]): MLValue[C[B]]
Specialized type cast that removes
MLValue[]
in arbitrary positions in the type parameter of this MLValue.Specialized type cast that removes
MLValue[]
in arbitrary positions in the type parameter of this MLValue. E.g., we can type castthis : MLValue[List[MLValue[X]]]
toMLValue[List[X]]
by invokingthis.removeMLValue[List,X]
Such type casts are safe because the the wayMLValue[...]
is interpreted in the type parameter toMLValue
(see MLValueConverter). The same type cast could be achieved using.asInstanceOf
, butinsertMLValue
guarantees that no unsafe cast is accidentally performed.- Definition Classes
- MLValue
- Annotations
- @inline()
- def retrieve(implicit converter: Converter[(D) => R], isabelle: Isabelle, ec: ExecutionContext): Future[(D) => R]
Retrieves the value referenced by this MLValue from the Isabelle process.
Retrieves the value referenced by this MLValue from the Isabelle process.
In particular, the value in the Isabelle process (a value in ML) is translated to a Scala value.
- converter
This converter specifies how the value is to be retrieved from the Isabelle process and translated into a Scala value of type
A
- isabelle
The Isabelle instance holding the value. This must be the same
Isabelle
instance relative to which theMLValue
was created. (Otherwise unspecified data is returned or an exception thrown.) In an application with only a singleIsabelle
instance that instance can safely be declared as an implicit.- returns
Future holding the value (as a Scala value) or an IsabelleException if the computation of that value or the transfer to Scala failed.
- Definition Classes
- MLValue
- Annotations
- @inline()
- def retrieveNow(implicit converter: Converter[(D) => R], isabelle: Isabelle, ec: ExecutionContext): (D) => R
Like retrieve but returns the Scala value directly instread of a future (blocks till the computation and transfer finish.
Like retrieve but returns the Scala value directly instread of a future (blocks till the computation and transfer finish.
- Definition Classes
- MLValue
- Annotations
- @inline()
- def someFuture: Future[Any]
Returns a future that completes when the computation of this object is complete.
Returns a future that completes when the computation of this object is complete. (Or that holds an exception if that computation throws an exception.) However, upon successful completion, the future may return an arbitrary (and thus useless) value. May be faster to implement than forceFuture because there may be already a future available but that returns the wrong value.
- Definition Classes
- MLValue → FutureValue
- def stateString: String
A utility method that returns "" if this value was successfully computed, " (computing)" if it still computes, and " (failed)" if it finished with an exception.
A utility method that returns "" if this value was successfully computed, " (computing)" if it still computes, and " (failed)" if it finished with an exception.
This can be useful to constructing human readable messages about this value.
- Definition Classes
- FutureValue
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- 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])