All Downloads are FREE. Search and download functionalities are using the official Maven repository.

arrow.meta.phases.analysis.diagnostic.Renderers.kt Maven / Gradle / Ivy

There is a newer version: 2.0.0-alpha.6
Show newest version
package arrow.meta.phases.analysis.diagnostic

import arrow.meta.plugins.proofs.phases.Proof
import arrow.meta.plugins.proofs.phases.asString
import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticParameterRenderer
import org.jetbrains.kotlin.diagnostics.rendering.RenderingContext
import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.types.KotlinType

@JvmField
val RenderProof: DiagnosticParameterRenderer =
  object : DiagnosticParameterRenderer {
    override fun render(obj: Proof, renderingContext: RenderingContext): String = obj.asString()
  }

@JvmField
val RenderProofs: DiagnosticParameterRenderer> =
  object : DiagnosticParameterRenderer> {
    override fun render(obj: Collection, renderingContext: RenderingContext): String =
      obj.joinToString(separator = ",\n") { it.asString() }
  }

val ProofRenderer: DescriptorRenderer = DescriptorRenderer.FQ_NAMES_IN_TYPES

@JvmField
val RenderTypes: DiagnosticParameterRenderer =
  object : DiagnosticParameterRenderer {
    override fun render(obj: KotlinType, renderingContext: RenderingContext): String =
      ProofRenderer.renderType(obj)
  }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy