package mlvalue
This package contains classes for type safe manipulation of values stored in a running Isabelle process (managed by an instance of control.Isabelle). See MLValue for an introduction.
- Source
- package.scala
- Alphabetic
- By Inheritance
- mlvalue
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- abstract class AdHocConverter extends OperationCollection
This class allows to add support for Isabelle ML types in Scala in a quick ad-hoc way.
This class allows to add support for Isabelle ML types in Scala in a quick ad-hoc way.
Let
something
be an ML type. To support values of ML typetype
in Scala, writeobject Something extends AdHocConverter("something")
(Here
Something
is an arbitrary identifier that should preferably remind of the ML typesomething
.) Then ML values of typesomething
stored in the Isabelle process can be used in Scala as objects of typeSomething.
T. That is, anSomething.
T is a thin wrapper around an MLValue that references values of typesomething
. The actual ML value is never transferred from Isabelle.An MLValueConverter is automatically available for type
Something.
T, thus, e.g., MLValue.apply and MLValue.retrieveNow and related functions work properly to translate betweenSomething.
T andMLValue[Something.T]
.Note: This is only intended for local use. That is, if some Scala code needs to handle ML values for which there is no proper support, and that just need to be passed around between different ML functions, then it is possible to use this class for supporting them with minimal boilerplate. However, if the Scala types representing the ML values are supposed to be used on a larger scale or exported from a library, or are supposed to be extended, then it is recommended to use a more flexible mechanism such as MLValueWrapper for creating wrapper classes for ML values.
Note:
object ... extends AdHocConverter(...)
creates a new exception type in ML when it is created. Thus this declaration should only be used in a static context (toplevel/inside an object) or in classes that are instantiated very rarely (or in OperationCollection.Ops in a static object).Usage example: Say we want to use the ML function
Simplifier.pretty_simpset: bool -> Proof.context -> Pretty.T
. This function returns aPretty.T
which is not (currently) directly supported by this library. But we simply want to pass it on toPretty.unformatted_string_of: Pretty.T -> string
. So we can declareobject Pretty extends AdHocConverter("Pretty.T") val pretty_simpset = MLValue.compileFunction[Boolean, Context, Pretty.T]("Simplifier.pretty_simpset") val unformatted_string_of = MLValue.compileFunction[Pretty.T, String]("Pretty.unformatted_string_of")
and then pretty print the simpset of a context
ctxt
byval string : String = unformatted_string_of(pretty_simpset(false, ctxt).retrieveNow).retrieveNow
(Or without the first
.retrieveNow
.) - final class FunctionConverter[D, R] extends Converter[(D) => R]
MLValue.Converter for type
D => R
.MLValue.Converter for type
D => R
.- ML type:
d -> r
(ifd,r
are the ML types corresponding toD
,R
). - Encoding of a function
f
as an exception: E_Function (DObject o val2exnR o f o exn2valD o (fn DObject e => e))where
exn2valDis a function that converts an exception back to a value of type
d, and
val2exnRis a function that converts a value of type
rto an exception (as specified by the converters for types
d,
r).
Note that store is not supported by this converter. That means that
MLValue(f)
for a Scala functionf
will fail (since a Scala function cannot be transferred to the Isabelle process). However, retrieve works, thusmlF.retrieveNow
formlF : MLValue[D=>R]
will return a function (that calls back to the Isabelle process whenever executed). But the preferred way to invokemlF
is to convert it into an MLFunction bymlF.function
and invoke the resulting MLFunction. Another way to generate anMLValue[D=>R]
is using MLValue.compileFunction to compile the function from ML source code.While the existence of this conversion makes it possible to use functions as arguments to other functions (and thus do arbitrary higher order computations), we suspect that the presence of nested conversions (the composition with
val2exnR
andexn2valD
above) can make this slow in more complex cases. (We have not benchmarked this, though.)- Annotations
- @inline()
- See also
MLValue.Converter for explanations what Converters are for.
- ML type:
- final class ListConverter[A] extends Converter[List[A]]
MLValue.Converter for type List[A].
MLValue.Converter for type List[A].
- ML type:
a list
(ifa
is the ML type corresponding toA
). - Encoding of a list
[x_1,...,x_n]
as an exception:E_List [e_1,...,e_n]
wheree_i
is the encoding ofx_i
as an exception (according to the converter forA
).
- Annotations
- @inline()
- See also
MLValue.Converter for explanations what Converters are for.
- ML type:
- class MLFunction[D, R] extends MLValue[(D) => R]
An MLValue that refers to an ML function in the Isabelle process.
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 anMLValue[D => R]
, you can convert it to an MLFunction using MLValue.function. - class MLFunction0[R] extends MLFunction[Unit, R]
A refinement of MLFunction (see there).
A refinement of MLFunction (see there). If the function takes a unit-value as an argument, then we can treat it as a function with no arguments. Thus this class adds additional method for invoking the function with no arguments instead of expecting a dummy unit-value. An MLValue (or MLFunction) can be converted into an MLFunction0 using MLValue.function0.
- class MLFunction2[D1, D2, R] extends MLFunction[(D1, D2), R]
A refinement of MLFunction (see there).
A refinement of MLFunction (see there). If the function takes a pair
(d1,d2)
as an argument, then we can treat it as a function with two argumentsd1
andd2
. Thus this class adds additional method for invoking the function with two arguments instead of a tuple. An MLValue (or MLFunction) can be converted into an MLFunction2 using MLValue.function2. - class MLFunction3[D1, D2, D3, R] extends MLFunction[(D1, D2, D3), R]
Analogue to MLFunction2 but for three arguments.
Analogue to MLFunction2 but for three arguments. See MLFunction2.
- class MLFunction4[D1, D2, D3, D4, R] extends MLFunction[(D1, D2, D3, D4), R]
Analogue to MLFunction2 but for four arguments.
Analogue to MLFunction2 but for four arguments. See MLFunction2.
- class MLFunction5[D1, D2, D3, D4, D5, R] extends MLFunction[(D1, D2, D3, D4, D5), R]
Analogue to MLFunction2 but for five arguments.
Analogue to MLFunction2 but for five arguments. See MLFunction2.
- class MLFunction6[D1, D2, D3, D4, D5, D6, R] extends MLFunction[(D1, D2, D3, D4, D5, D6), R]
Analogue to MLFunction2 but for six arguments.
Analogue to MLFunction2 but for six arguments. See MLFunction2.
- class MLFunction7[D1, D2, D3, D4, D5, D6, D7, R] extends MLFunction[(D1, D2, D3, D4, D5, D6, D7), R]
Analogue to MLFunction2 but for seven arguments.
Analogue to MLFunction2 but for seven arguments. See MLFunction2.
- class MLRetrieveFunction[A] extends AnyRef
A compiled ML function specifically transmitting values from Isabelle to Scala.
A compiled ML function specifically transmitting values from Isabelle to Scala.
The function is created by
val f = MLRetrieveFunction(ml)
whereml
is ML code of typea -> data
, anda
is the ML type corresponding toA
.When
f(mlVal : MLValue[A])
is invoked in Scala, the compiled ML functionml
is applied to the ML value of typea
referenced bymlVal
in the object store in the Isabelle process. The result (of ML typedata
) is then transferred back to Scala and returned (in a Future).An MLRetrieveFunction is particularly useful for writing retrieve methods when writing an MLValue.Converter.
The behavior of an MLRetrieveFunction
[A]
is very similar to an MLFunction[A,Data]
but more efficient. And the MLRetrieveFunction additionally does not access the store and retrieve functions of the converter that is passed as an implicit argument. This is important because we use the MLRetrieveFunction for writing those functions in the first place. - class MLStoreFunction[A] extends AnyRef
A compiled ML function specifically transmitting values from Scala to Isabelle.
A compiled ML function specifically transmitting values from Scala to Isabelle.
The function is created by
val f = MLStoreFunction(ml)
whereml
is ML code of typedata -> a
, anda
is the ML type corresponding toA
.When
f(data)
is invoked in Scala (withdata
of type Data), the compiled ML functionml
is applied todata
(in the Isabelle process), and the resulting value is stored in the object store, and an MLValue containing the ID is returned.An MLStoreFunction is particularly useful for writing store methods when writing an MLValue.Converter.
The behavior of an MLStoreFunction
[A]
is very similar to an MLFunction[Data,A]
but more efficient. And the MLStoreFunction additionally does not access the store and retrieve functions of the converter that is passed as an implicit argument. This is important because we use the MLStoreFunction for writing those functions in the first place. - class MLValue[A] extends FutureValue
A type safe wrapper for values stored in the Isabelle process managed by Isabelle.
A type safe wrapper for values stored in the Isabelle process managed by Isabelle.
As explained in the documentation of Isabelle, the Isabelle process has an object store of values, and the class Isabelle.ID is a reference to an object in that object store. However, values of different types share the same object store. Thus Isabelle.ID is not type safe: there are compile time guarantees that the value referenced by that ID has a specific type.
MLValue[A] is a thin wrapper around an ID id (more precisely, a future holding an ID). It is guaranteed that id references a value in the Isabelle process of an ML type corresponding to
A
(or throw an exception). (It is possible to violate this guarantee by type-casting the MLValue though.) For supported typesA
, it is possible to automatically translate a Scala valuex
of typeA
into anMLValue[A]
(which behind the scenes means thatx
is transferred to the Isabelle process and added to the object store) and also to automatically translate anMLValue[A]
back to a Scala value of typeA
. Supported types are Int, Long, Boolean, Unit, String, and lists and tuples (max. 7 elements) of supported types. (It is also possible forA
to be the typeMLValue[...]
, see MLValueConverter for explanations.) It is possible to add support for other types, see MLValue.Converter for instructions. Using this mechanism, support for the terms, types, theories, contexts, and theorems has been added in package de.unruh.isabelle.pure.In more detail:
- For any supported Scala type
A
there should be a unique corresponding ML typea
. (This is not enforced if we add support for new types, but if we violate this, we loose type safety.) - Several Scala types
A
are allowed to correspond to the same ML typea
. (E.g., both Long and Int correspond to the unboundedint
in ML.) - For each supported type
A
, the following must be specified (via an implicit MLValue.Converter):- an encoding of
a
as an exception (to be able to store it in the object store) - ML functions to translate between
a
and exceptions and back - retrieve function: how to retrieve an exception encoding an ML value of type
a
and translate it into anA
in Scala - store function: how to translate an
A
in Scala into an an exception encoding an ML value of typea
and store it in the object store.
- an encoding of
MLValue(x)
automatically translatesx:A
into a value of typea
(using the retrieve function) and returns anMLValue[A]
.- If
m : MLValue[A]
, thenm.
retrieve (asynchronous) andm.
retrieveNow (synchronous) decode the ML value in the object store and return a Scala value of typeA
. - ML code that operates on values in the Isabelle process can be specified using MLValue.compileValue
and MLValue.compileFunction. This ML code directly operates on the
corresponding ML type
a
and does not need to consider the encoding of ML values as exceptions or how ML types are serialized to be transferred to Scala (all this is handled automatically behind the scenes using the information provided by the implicit MLValue.Converter). - To be able to use the automatic conversions etc., converters need to be imported for supported types.
The converters provided by this package can be imported by
import de.unruh.isabelle.mlvalue.Implicits._
. - MLValues are asynchronous, i.e., they may finish the computation of the contained value after creation of the
MLValue
object. (Like a Future.) In particular, exception thrown during the computation are not thrown during object creation. The value inside an MLValue can be retrieved using retrieveNow (or retrieve), this may wait for the computation to finish and force the exceptions to be thrown. However, instead the value returned by retrieveNow may also be an asynchronous value in the sense that it is created before the computation defining it has finished. Thus exceptions thrown in the computation of the MLValue may be delayed even further and only show upon later computations with the returned object. To make sure that the computation of the MLValue has completed, use the methods of FutureValue (which MLValue inherits), such as force. - We have the convention that if
A
is not a subtype of FutureValue, then retrieveNow must throw the exceptions raised during the computation of theMLValue
, and retrieve must return a future that holds those exceptions. (That is, in this case the considerations of the preceding bullet point do not apply.) For example, ifMLValue[Unit].retrieveNow
orMLValue[Int].retrieveNow
guarantee that all exceptions are thrown (i.e., if those function calls complete without exception, the underlying computation is guaranteed to be have completed without exception). IfMLValue[Term].retrieveNow
completes without exception, this is not guaranteed (because Term is a subtype of FutureValue). ButMLValue[Term].force.retrieveNow
andMLValue[Term].retrieveNow.force
both guarantee that all exceptions are thrown.
Note: Some operations take an Isabelle instance as an implicit argument. It is required that this instance the same as the one relative to which the MLValue was created.
A full example:
implicit val isabelle: Isabelle = new Isabelle(...) import scala.concurrent.ExecutionContext.Implicits._ // Create an MLValue containing an integer val intML : MLValue[Int] = MLValue(123) // 123 is now stored in the object store // Fetching the integer back val int : Int = intML.retrieveNow assert(int == 123) // The type parameter of MLValue ensures that the following does not compile: // val string : String = intML.retrieveNow // We write an ML function that squares an integer and converts it into a string val mlFunction : MLFunction[Int, String] = MLValue.compileFunction[Int, String]("fn i => string_of_int (i*i)") // We can apply the function to an integer stored in the Isabelle process val result : MLValue[String] = mlFunction(intML) // The result is still stored in the Isabelle process, but we can retrieve it: val resultHere : String = result.retrieveNow assert(resultHere == "15129")
Not that the type annotations in this example are all optional, the compiler infers them automatically. We have included them for clarity only.
- A
the Scala type corresponding to the ML type of the value referenced by id
- For any supported Scala type
- final class MLValueConverter[A] extends Converter[MLValue[A]]
A special MLValue.Converter that allows us to create MLValues that contain MLValues.
A special MLValue.Converter that allows us to create MLValues that contain MLValues.
- MLType:
exn
. - Constraint on the values: only
exn
's that are the encoding of a value of type aas an exception are allowed. (
ais the type associated with
A)
- Encoding of
exn
as an exception: itself
The benefit of this special converter is probably best illustrated by an example. Say
Huge
is an Scala type corresponding to an ML typehuge
. And assume transferringhuge
between the Isabelle process and Scala is expensive (or maybe even impossible). And say we have anmyValue : MLValue[List[Huge]]
which contains a long list ofhuge
in the Isabelle process. We can get aList[Huge]
by callingmyValue.retrieveNow
, but this might be too expensive, especially if we do not need the whole list. Instead, we can do:val myValue2 : MLValue[List[MLValue[Huge]]] = myValue.asInstanceOf[MLValue[List[MLValue[Huge]]]] val myList : List[MLValue[Huge]] = myValue2.retrieveNow
myList
now is a list ofMLValue[Huge]
and is constructed efficiently (because anMLValue[Huge]
just references an object in the Isabelle process's object store). And then one can retrieve individualHuge
objects in that list with additional calls .retrieveNow (or just use the values without ever retrieving them as arguments to other functions that reside in the ML process).An instance of MLValueConverter can be constructed without using a Converter for
A
. This means the above approach (except for retrieving values of typehuge
) can even be used if no converter forA
has not actually been implemented. (As long as we consistently imagine a specific ML type and encoding forA
.)- Annotations
- @inline()
- MLType:
- trait MLValueWrapper[A <: MLValueWrapper[A]] extends FutureValue
Base trait to simplify creating classes that contain a reference to a value in the Isabelle process.
Base trait to simplify creating classes that contain a reference to a value in the Isabelle process. Classes inheriting from this trait contain an MLValue that refers to a value in the Isabelle process. (That is, unless the inheriting class specifies further fields, this is the only data carried by the class. In particular, the class will not transfer data from the Isabelle process.)
Examples of classes based on MLValueWrapper are pure.Context, pure.Thm, pure.Position.
The minimal implementation of a class based on MLValueWrapper is as follows:
final class Something private (val mlValue: MLValue[Something]) extends MLValueWrapper[Something] object Something extends MLValueWrapper.Companion[Something] { override protected val mlType: String = "Something" override protected def instantiate(mlValue: MLValue[Something]): Something = new Something(mlValue) }
Here
Something
is the name of the Scala class that we want to implement, andsomething
is the ML type of the corresponding values in the Isabelle process.After importing
Something.
converter, the typeSomething
can be transparently used to refer tosomething
in the Isabelle process. E.g., MLValue.compileFunction[String,Something]
or MLValue(st)
forst
of typeSomething
ormlst.
retrieveNow formlst
of type MLValue[Something]
.The class
Something
may be customized in several ways:- By default, an ML value
st : something
is encoded as an exception (see the description of MLValue) asEXN st
whereEXN
is an ML exception whose name is returned by Something.exceptionName. The nameEXN
is automatically chosen and the exception declared. If this is not desired, a different exception name can be provided by defining predefinedException in the companion objectSomething
. - Arbitrary additional methods and fields can be added to the definition of the class
Something
or the companion objectSomething
. However, it should be noted that the constructor ofSomething
can only have arguments mlValue:
MLValue[Something]
and optionally an Isabelle instance and an ExecutionContext and not other user defined values. (This is because the constructor needs to be invoked by Something.instantiate which does not have access to other data.) - To implement functions that invoke ML code in the Isabelle process, it is recommended to place the compiled
values inside an
Ops
class (see OperationCollection) in the companion objectSomething
. Since the base trait MLValueWrapper.Companion already definesOps
, this needs to be done as follows:
override protected def newOps(implicit isabelle: Isabelle, ec: ExecutionContext): Ops = new Ops protected class Ops(implicit isabelle: Isabelle, ec: ExecutionContext) extends super.Ops { // Example: lazy val test: MLFunction[Something,String] = compileFunction[Something,String]("... : something -> string") }
The class
Something
represents an asynchronous value. That is, it is possible to have get an instance ofSomething
even if the computation computing the corresponding ML value is still ongoing or has failed. To wait for that computation to terminate successfully, use the methods from FutureValue whichSomething
inherits.Note: Another possibility for defining wrapper classes for MLValues is AdHocConverter. Classes derived using AdHocConverter cannot be customized but only minimal boilerplate is needed.
- By default, an ML value
- final class OptionConverter[A] extends Converter[Option[A]]
MLValue.Converter for type Option[A].
MLValue.Converter for type Option[A].
- ML type:
a option
(ifa
is the ML type corresponding toA
). - Encoding of
Some(x)
andNone
as an exception:E_Option (SOME e)
andE_Option NONE
e
is the encoding ofx
as an exception (according to the converter forA
).
- Annotations
- @inline()
- See also
MLValue.Converter for explanations what Converters are for.
- ML type:
- final class Tuple2Converter[A, B] extends Converter[(A, B)]
MLValue.Converter for type
(A,B)
.MLValue.Converter for type
(A,B)
.- ML type:
a * b
(ifa,b
are the ML types corresponding toA
,B
). - Encoding of a pair (x_A,x_B) as an exception:
E_Pair e_A e_B
wheree_T
is the encoding ofx_T
as an exception (according to the converter for typeT
).
- Annotations
- @inline()
- See also
MLValue.Converter for explanations what Converters are for.
- ML type:
- final class Tuple3Converter[A, B, C] extends Converter[(A, B, C)]
MLValue.Converter for type
(A,B,C)
.MLValue.Converter for type
(A,B,C)
.- ML type:
a * b * c
(ifa,b,c
are the ML types corresponding toA
,B
,C
). - Encoding of a pair (x_A,x_B,x_C) as an exception:
E_Pair e_A (E_Pair e_B e_C)
wheree_T
is the encoding ofx_T
as an exception (according to the converter for typeT
).
- Annotations
- @inline()
- See also
MLValue.Converter for explanations what Converters are for.
- ML type:
- final class Tuple4Converter[A, B, C, D] extends Converter[(A, B, C, D)]
MLValue.Converter for type
(A,B,C,D)
.MLValue.Converter for type
(A,B,C,D)
.- ML type:
a * b * c * d
(ifa,b,c,d
are the ML types corresponding toA
,B
,C
,D
). - Encoding of a pair (x_A,x_B,x_C,x_D) as an exception:
E_Pair e_A (E_Pair e_B (E_Pair e_C e_D))
wheree_T
is the encoding ofx_T
as an exception (according to the converter for typeT
).
- Annotations
- @inline()
- See also
MLValue.Converter for explanations what Converters are for.
- ML type:
- final class Tuple5Converter[A, B, C, D, E] extends Converter[(A, B, C, D, E)]
MLValue.Converter for type
(A,B,C,D,E)
.MLValue.Converter for type
(A,B,C,D,E)
.- ML type:
a * b * c * d * e
(ifa,b,c,d,e
are the ML types corresponding toA
,B
,C
,D
,E
). - Encoding of a pair (x_A,x_B,x_C,x_D,x_E) as an exception:
E_Pair e_A (E_Pair e_B (E_Pair e_C (E_Pair e_D e_E)))
wheree_T
is the encoding ofx_T
as an exception (according to the converter for typeT
).
- See also
MLValue.Converter for explanations what Converters are for.
- ML type:
- final class Tuple6Converter[A, B, C, D, E, F] extends Converter[(A, B, C, D, E, F)]
MLValue.Converter for type
(A,B,C,D,E,F)
.MLValue.Converter for type
(A,B,C,D,E,F)
.- ML type:
a * b * c * d * e * f
(ifa,b,c,d,e,f
are the ML types corresponding toA
,B
,C
,D
,E
,F
). - Encoding of a pair (x_A,x_B,x_C,x_D,x_E,x_F) as an exception:
E_Pair e_A (E_Pair e_B (E_Pair e_C (E_Pair e_D (E_Pair e_E e_F))))
wheree_T
is the encoding ofx_T
as an exception (according to the converter for typeT
).
- Annotations
- @inline()
- See also
MLValue.Converter for explanations what Converters are for.
- ML type:
- final class Tuple7Converter[A, B, C, D, E, F, G] extends Converter[(A, B, C, D, E, F, G)]
MLValue.Converter for type
(A,B,C,D,E,F,G)
.MLValue.Converter for type
(A,B,C,D,E,F,G)
.- ML type:
a * b * c * d * e * f * g
(ifa,b,c,d,e,f,g
are the ML types corresponding toA
,B
,C
,D
,E
,F
,G
). - Encoding of a pair (x_A,x_B,x_C,x_D,x_E,x_F,x_G) as an exception:
E_Pair e_A (E_Pair e_B (E_Pair e_C (E_Pair e_D (E_Pair e_E (E_Pair e_F e_G)))))
wheree_T
is the encoding ofx_T
as an exception (according to the converter for typeT
).
- Annotations
- @inline()
- See also
MLValue.Converter for explanations what Converters are for.
- ML type:
Value Members
- object BigIntConverter extends Converter[BigInt]
MLValue.Converter for BigInts.
MLValue.Converter for BigInts.
- ML type:
int
- Encoding of an integer
i
as an exception:E_Int i
Note that IntConverter, LongConverter, BigIntConverter are different Converters for the same ML type
int
. They have compatible representations as exceptions, they can safely be typecast into each other.- See also
MLValue.Converter for explanations what Converters are for.
- ML type:
- object BooleanConverter extends Converter[Boolean]
MLValue.Converter for Booleans.
MLValue.Converter for Booleans.
- ML type:
bool
- Encoding of a bool
b
as an exception:E_Bool b
- See also
MLValue.Converter for explanations what Converters are for.
- ML type:
- object DataConverter extends Converter[Data]
MLValue.Converter for Isabelle.Datas.
MLValue.Converter for Isabelle.Datas.
- ML type:
data
- Encoding of an
d : data
as an exception:E_Data d
- See also
MLValue.Converter for explanations what Converters are for.
- ML type:
- object Implicits
- object IntConverter extends Converter[Int]
MLValue.Converter for Ints.
MLValue.Converter for Ints.
- ML type:
int
- Encoding of an integer
i
as an exception:E_Int i
Note that there is an incompatibility between ML
int
and Scala Int. The former is unbounded while the latter is a 32-bit integer. MLint
s that do not fit are truncated upon retrieval (that is, no overflow exception is thrown!) Use BigIntConverter if arbitrary length integers should be handled.Note that IntConverter, LongConverter, BigIntConverter are different Converters for the same ML type
int
. They have compatible representations as exceptions, they can safely be typecast into each other.- See also
MLValue.Converter for explanations what Converters are for.
- ML type:
- object LongConverter extends Converter[Long]
MLValue.Converter for Longs.
MLValue.Converter for Longs.
- ML type:
int
- Encoding of an integer
i
as an exception:E_Int i
Note that there is an incompatibility between ML
int
and Scala Long. The former is unbounded while the latter is a 64-bit integer. MLint
s that do not fit are truncated upon retrieval (that is, no overflow exception is thrown!) Use BigIntConverter if arbitrary length integers should be handled.Note that IntConverter, LongConverter, BigIntConverter are different Converters for the same ML type
int
. They have compatible representations as exceptions, they can safely be typecast into each other.- See also
MLValue.Converter for explanations what Converters are for.
- ML type:
- object MLFunction
- object MLFunction0
- object MLFunction2
- object MLFunction3
- object MLFunction4
- object MLFunction5
- object MLFunction6
- object MLFunction7
- object MLRetrieveFunction
Creates an MLRetrieveFunction from ML code
ml
.Creates an MLRetrieveFunction from ML code
ml
.The ML code
ml
should have typea -> data
wherea
is the ML type associated withA
by the implicit Converter.This method will not invoke
converter.
store orconverter.
retrieve. - object MLStoreFunction
- object MLValue extends OperationCollection
- object MLValueWrapper
- object StringConverter extends Converter[String]
MLValue.Converter for Strings.
MLValue.Converter for Strings.
- ML type:
string
- Encoding of a string
s
as an exception:E_String s
Note that there is an incompatibility between ML
string
and Scala String. The former is restricted to characters with codepoints 0...255 (with no specified character set interpretation for characters over 128) and can be at most 67.108.856 characters long (String.maxSize
in ML). The latter has 16-bit Unicode characters and no length limit. This converter will work correctly for ASCII strings of the maximum ML-length, but throw exceptions when storing longer strings, and replace non-ASCII characters in unspecified ways.- See also
MLValue.Converter for explanations what Converters are for.
- ML type:
- object UnitConverter extends Converter[Unit]
MLValue.Converter for Units.
MLValue.Converter for Units.
- ML type:
unit
- Encoding of the unit value as an exception:
E_Int 0
- See also
MLValue.Converter for explanations what Converters are for.
- ML type:
- object Version extends OperationCollection
Version information for the Isabelle process.
Version information for the Isabelle process.
All methods take the Isabelle process as an implicit parameter. The integers year, step, rc are chosen such that
(year,step,rc)
is increasing lexicographically if the version increases. (Development releases are currently not supported and may break this ordering.)