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

arrow.meta.dsl.platform.Platform.kt Maven / Gradle / Ivy

There is a newer version: 1.6.3-alpha.2
Show newest version
package arrow.meta.dsl.platform

import org.jetbrains.kotlin.com.intellij.openapi.project.Project

private val isIde: Boolean = Project::class.java.name == "com.intellij.openapi.project.Project"

private val isCli: Boolean =
  !isIde && Project::class.java.name == "org.jetbrains.kotlin.com.intellij.openapi.project.Project"

/**
 * The [cli] function selectively evaluates [f] in the Command Line Compiler. [f] is ignored if this
 * is an IDEA plugin
 */
fun  cli(f: () -> A): A? = if (isCli) f() else null

/**
 * The [ide] function selectively evaluates [f] in the IDEA plugin. [f] is ignored if this is an
 * command line compiler plugin
 */
fun  ide(f: () -> A): A? = if (isIde) f() else null




© 2015 - 2025 Weber Informatics LLC | Privacy Policy