arrow-meta / arrow.meta.encoder / MetaApi

MetaApi

interface MetaApi

Arrow-Meta provides a hydrated AST representing Kotlin Code. The current implementation relies on TypeElement, KotlinMetadata library and Kotlin Poet to get all the info it needs so you can access the values without manually fiddling with proto buffers or java reflection.

The current implementation includes support for TypeClassInstance and all the subtrees under the Tree hierarchy as well as the notion of emulated higher kinded types via arrow.Kind. Among other things one can defunctionalize a Kinded value representation into it’s concrete counter part: Kind<ForIO, A> -> IO<A>

Properties

downKind Performs a type application transforming a type in kinded position into it’s concrete counterpart: ex: Kind<ForIO, A> -> IO<A>abstract val TypeName.downKind: TypeNameabstract val TypeVariable.downKind: TypeName
abstract val FunctionLiteral.downKind: TypeName
abstract val ParameterizedType.downKind: TypeName
abstract val WildcardType.downKind: TypeName
abstract val Classy.downKind: TypeName
kinded Determine if this TypeName.ParameterizedType is in kinded position. ex: arrow.Kind<ForIO, A> => true ex: IO<A> => falseabstract val ParameterizedType.kinded: Boolean
nestedTypeVariables Recursively gathers all the nested TypeName.TypeVariable inside a TypeNameabstract val TypeName.nestedTypeVariables: List<TypeName>abstract val TypeVariable.nestedTypeVariables: List<TypeName>
abstract val WildcardType.nestedTypeVariables: List<TypeName>
abstract val FunctionLiteral.nestedTypeVariables: List<TypeName>
abstract val ParameterizedType.nestedTypeVariables: List<TypeName>
abstract val Classy.nestedTypeVariables: List<TypeName>
projectedCompanion Returns a suitable companion for this type considering it’s kinded or conested position. This is frequently use to project extensions or other static instances as needed via codegenabstract val TypeName.projectedCompanion: TypeName
requiredAbstractFunctions The list of functions a type class instance needs to implement to resolve it’s hierarchical dependencies to other type classes ex: override fun MF(): arrow.typeclasses.Monad in the KleisliMonadInstanceabstract val TypeClassInstance.requiredAbstractFunctions: List<Func>
requiredParameters The list of parameters a type class instance needs to be able to implement the requiredAbstractFunctions ex: override fun MF: Monad in KleisliMonadInstanceabstract val TypeClassInstance.requiredParameters: List<Parameter>
type Obtains type information for a class or interface given a TypeNameabstract val TypeName.type: Type?

Functions

addExtraDummyArg Appends (…argN: Unit = Unit) at the end of the parameter lists of this function. This is frequently done to work around JVM overload clashes specially when extending kinded values which show the same JVM signature after erasureabstract fun Func.addExtraDummyArg(): Func
asKotlin Normalizes potentially rogue types coming from Java introspection into their Kotlin counterpart. ex: java.lang.Integer -> Kotlin.Int It’s implementation is partial and does not cover all corner cases.abstract fun TypeName.asKotlin(): TypeNameabstract fun TypeVariable.asKotlin(): TypeVariable
abstract fun ParameterizedType.asKotlin(): ParameterizedType
abstract fun FunctionLiteral.asKotlin(): FunctionLiteral
abstract fun WildcardType.asKotlin(): WildcardType
abstract fun Classy.asKotlin(): Classy
asPlatform Attempts to lookup the platform counter type of a kotlin platform type like ex: in the JVM kotlin.Int -> java.lang.Integerabstract fun Classy.asPlatform(): Classy
containsModifier Whether this function contains a modifier such as Modifier.Final, etc.abstract fun Func.containsModifier(modifier: Modifier): Boolean
countDummyArgs Number of dummy arguments contained in this functionabstract fun Func.countDummyArgs(): Int
defaultDummyArgValue Returns a new parameter with Unit as default value if this of type unitabstract fun Parameter.defaultDummyArgValue(): Parameter
defaultDummyArgValues Applies default values to dummy argsabstract fun Func.defaultDummyArgValues(): Func
downKind Performs a type application transforming the type of this parameter in kinded position into it’s concrete counterpart: ex: arg: Kind<ForIO, A> -> arg: IO<A>abstract fun Parameter.downKind(): Parameter
downKindParameters Performs a type application transforming all parameter types in this function in kinded position into it’s concrete counterpart: ex: (fa: Kind<ForIO, A>) -> (fa: IO<A>)abstract fun Func.downKindParameters(): Func
downKindReceiver Performs a type application transforming the receiver type in this function in kinded position into it’s concrete counterpart: ex: Kind<ForIO, A>.someFun(): A -> IO.someFun(): Aabstract fun Func.downKindReceiver(): Func
downKindReturnType Performs a type application transforming the return type in this function in kinded position into it’s concrete counterpart: ex: someFun(): Kind<ForIO, A> -> someFun(): IO<A>abstract fun Func.downKindReturnType(): Func
JvmName A instance of @JvmName in the Arrow Meta ASTabstract fun JvmName(name: String): Annotation
prependExtraDummyArg Prepends (…argN: Unit = Unit) at the beginning of the parameter lists of this function. This is frequently done to work around JVM overload clashes specially when extending kinded values which show the same JVM signature after erasureabstract fun Func.prependExtraDummyArg(): Func
PublishedApi A instance of @PublishedApi in the Arrow Meta ASTabstract fun PublishedApi(): Annotation
removeConstrains Remove undesired constrains such as java.lang.Object which appears in upper bound position in certain type shapesabstract fun WildcardType.removeConstrains(): WildcardTypeabstract fun ParameterizedType.removeConstrains(): ParameterizedType
abstract fun Classy.removeConstrains(): Classy
abstract fun FunctionLiteral.removeConstrains(): FunctionLiteral
abstract fun TypeName.removeConstrains(): TypeName
abstract fun TypeVariable.removeConstrains(): TypeVariable
abstract fun Parameter.removeConstrains(): Parameter
Removes all modifiers and annotations from this function and normalizes type variables upper bound constrains to not explicitly include implicit types such as java.lang.Object. Preserves all modifiers keepModifiersabstract fun Func.removeConstrains(keepModifiers: Set<Modifier> = emptySet()): Func
removeDummyArgs Removes all dummy args from this function.abstract fun Func.removeDummyArgs(): Func
SuppressAnnotation A instance of @SuppressAnnotation in the Arrow Meta ASTabstract fun SuppressAnnotation(vararg names: String): Annotation
widenTypeArgs Resets all type arguments to Any?abstract fun TypeName.widenTypeArgs(): TypeName

Companion Object Properties

TODO A block of code for a right hand side T O D O returnabstract val Code.Companion.TODO: Code

Companion Object Functions

typeNameOf Returns a type name given a KClassabstract fun <A : Any> TypeName.Companion.typeNameOf(clazz: KClass<A>): TypeName

Inheritors

JvmMetaApi A JVM implementation of the Meta Api meant to be mixed in with kapt annotation processorsinterface JvmMetaApi : MetaApi, TypeElementEncoder, ProcessorUtils, TypeDecoder
PolyTemplateGenerator interface PolyTemplateGenerator : MetaApi

Do you like Arrow?

Arrow Org
<