-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into arrow-v2.0.0-beta.1
- Loading branch information
Showing
39 changed files
with
403 additions
and
706 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
val optIns = listOf("com.huanshankeji.InternalApi", "com.huanshankeji.ExperimentalApi") | ||
|
||
inline fun forEachOptIn(action: (String) -> Unit) = | ||
optIns.forEach(action) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask | ||
|
||
plugins { | ||
id("common-conventions") | ||
id("com.huanshankeji.kotlin-jvm-library-sonatype-ossrh-publish-conventions") | ||
} | ||
|
||
kotlin.jvmToolchain(8) | ||
|
||
tasks.named<KotlinCompilationTask<*>>("compileKotlin").configure { | ||
forEachOptIn { compilerOptions.freeCompilerArgs.add("-opt-in=$it") } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// extracted into a separate script so the version can be set before `dokka-convention` | ||
|
||
version = projectVersion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
core/src/commonMain/kotlin/com/huanshankeji/ExperimentalApi.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.huanshankeji | ||
|
||
@RequiresOptIn("This API is experimental. It may be changed in the future without notice.", RequiresOptIn.Level.WARNING) | ||
@Retention(AnnotationRetention.BINARY) | ||
annotation class ExperimentalApi |
5 changes: 5 additions & 0 deletions
5
core/src/commonMain/kotlin/com/huanshankeji/FunctionImplementationRemoved.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.huanshankeji | ||
|
||
@ExperimentalApi | ||
fun functionImplementationRemoved(): Nothing = | ||
throw NotImplementedError("This function's implementation has been removed and the function will be removed too in the future.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...hankeji/kotlin/function/parametertypeparameter/NullableUnitReturnTypeParameterFunction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.huanshankeji.kotlin.function.parametertypeparameter | ||
|
||
import com.huanshankeji.ExperimentalApi | ||
|
||
private typealias NullableUnitReturnTypeParameterFunction<T> = ((T) -> Unit)? | ||
|
||
@ExperimentalApi | ||
inline operator fun <T> NullableUnitReturnTypeParameterFunction<T>.plus(noinline other: NullableUnitReturnTypeParameterFunction<T>): NullableUnitReturnTypeParameterFunction<T> = | ||
if (this === null) | ||
other | ||
else if (other === null) | ||
this | ||
else { | ||
{ | ||
this@plus(it) | ||
other(it) | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...nshankeji/kotlin/function/receivertypeparameter/NullableUnitReturnTypeReceiverFunction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.huanshankeji.kotlin.function.receivertypeparameter | ||
|
||
import com.huanshankeji.ExperimentalApi | ||
|
||
private typealias NullableUnitReturnTypeReceiverFunction<T> = (T.() -> Unit)? | ||
|
||
@ExperimentalApi | ||
inline operator fun <T> NullableUnitReturnTypeReceiverFunction<T>.plus(noinline other: NullableUnitReturnTypeReceiverFunction<T>): NullableUnitReturnTypeReceiverFunction<T> = | ||
if (this === null) | ||
other | ||
else if (other === null) | ||
this | ||
else { | ||
{ | ||
this@plus() | ||
other() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.huanshankeji.jdbc | ||
|
||
fun jdbcUrl(rdbms: String, host: String, port: Int?, database: String) = | ||
"jdbc:$rdbms://$host${port?.let { ":$it" } ?: ""}/$database" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...utines/src/commonMain/kotlin/com/huanshankeji/kotlinx/coroutine/CoroutineAutoCloseable.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.huanshankeji.kotlinx.coroutine | ||
|
||
import com.huanshankeji.ExperimentalApi | ||
import com.huanshankeji.kotlin.use | ||
|
||
/** | ||
* @see AutoCloseable | ||
* Also see https://github.com/Kotlin/kotlinx.coroutines/issues/1191. | ||
* Made a functional interface so that there is no need to add a function like the [AutoCloseable] one. | ||
*/ | ||
@ExperimentalApi | ||
fun interface CoroutineAutoCloseable { | ||
suspend fun close() | ||
} | ||
|
||
suspend inline fun <T : CoroutineAutoCloseable?, R> T.use(block: (T) -> R): R = | ||
use(block) { this?.close() } |
Oops, something went wrong.