public class RunTM
extends java.lang.Object
Constructor and Description |
---|
RunTM() |
Modifier and Type | Method and Description |
---|---|
static <G> G |
cast(java.lang.Object it)
This is used to correct the compile time type for higher ranked functions
or types instantiated with higher kinded arguments.
|
static int |
constructor(int it) |
static int |
constructor(java.lang.Object v) |
static int |
constructor(short it) |
static int |
constructor(Value v)
Implementation for
pure native constructor frege.run.RunTM.constructor :: a -> Int |
public static <G> G cast(java.lang.Object it)
This is used to correct the compile time type for higher ranked functions or types instantiated with higher kinded arguments.
Higher ranked functions are passed around withObject
in place of type variables,
and are instantiated at the needed type when they're used.
The operations of type classes with higher kinded type variables (i.e. Functor, Monad, etc.)
give rise to higher kinded types. The higher kinded type applications are modeled in Java
with one of the classes from Kind
. For example, a value with type
[Maybe Char]is normally encoded as
TList<TMaybe <Character>>
but when it is passed to some polymorphic function that expects at this place
[f e]
its Java type needs to be /p>
TList<Kind.U<TMaybe<?>, Character>>
to comply. Likewise, such kinded types need to be converted back to normal ones. But the Java compiler can only understand type conversions at the outermost level from normal to kinded (all suitable Frege types extend the possible Kind classes depending on the kind of their type constructor). There is simply no way to tell Java that the normal notation and the kinded notation describe the very same type. For example, it cannot understand that
Func.U<Kind.U<TMaybe<?>, Character>, Boolean>
is the same function type as
Func.U<TMaybe<Character>, Boolean>
Note that Frege type checking ensures that the given type is an instance of the original polymorphic type of the function, so the conversion is not really "unsafe".
it
- public static final int constructor(Value v)
pure native constructor frege.run.RunTM.constructor :: a -> Int
public static final int constructor(short it)
public static final int constructor(int it)
public static final int constructor(java.lang.Object v)