-
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,14 @@ | |
// - Show declarations: true | ||
|
||
// Library unique name: <com.huanshankeji:kotlin-common-core> | ||
open annotation class com.huanshankeji/ExperimentalApi : kotlin/Annotation { // com.huanshankeji/ExperimentalApi|null[0] | ||
constructor <init>() // com.huanshankeji/ExperimentalApi.<init>|<init>(){}[0] | ||
} | ||
|
||
open annotation class com.huanshankeji/InternalApi : kotlin/Annotation { // com.huanshankeji/InternalApi|null[0] | ||
constructor <init>() // com.huanshankeji/InternalApi.<init>|<init>(){}[0] | ||
} | ||
|
||
open annotation class com.huanshankeji/Untested : kotlin/Annotation { // com.huanshankeji/Untested|null[0] | ||
constructor <init>() // com.huanshankeji/Untested.<init>|<init>(){}[0] | ||
} | ||
|
@@ -64,6 +72,7 @@ final fun <#A: kotlin/Any?> (kotlin.sequences/Sequence<#A>).com.huanshankeji.seq | |
final fun <#A: kotlin/Comparable<#A>> (kotlin.collections/List<#A>).com.huanshankeji.collections/lexicographicOrderComparable(): com.huanshankeji.collections/LexicographicOrderListComparable<#A> // com.huanshankeji.collections/lexicographicOrderComparable|[email protected]<0:0>(){0§<kotlin.Comparable<0:0>>}[0] | ||
final fun <#A: kotlin/Enum<#A>> com.huanshankeji.kotlin/enumPlus(kotlin/Array<#A>, #A, kotlin/Int): #A // com.huanshankeji.kotlin/enumPlus|enumPlus(kotlin.Array<0:0>;0:0;kotlin.Int){0§<kotlin.Enum<0:0>>}[0] | ||
final fun com.huanshankeji.codec/uLongBigEndianShiftOffset(kotlin/Int): kotlin/Int // com.huanshankeji.codec/uLongBigEndianShiftOffset|uLongBigEndianShiftOffset(kotlin.Int){}[0] | ||
final fun com.huanshankeji/functionImplementationRemoved(): kotlin/Nothing // com.huanshankeji/functionImplementationRemoved|functionImplementationRemoved(){}[0] | ||
final inline fun <#A: kotlin/Any> com.huanshankeji.kotlin/produceInCallback(kotlin/Function1<kotlin/Function1<#A, kotlin/Unit>, kotlin/Unit>): #A // com.huanshankeji.kotlin/produceInCallback|produceInCallback(kotlin.Function1<kotlin.Function1<0:0,kotlin.Unit>,kotlin.Unit>){0§<kotlin.Any>}[0] | ||
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?> (#A).com.huanshankeji.kotlin/use(kotlin/Function1<#A, #B>, kotlin/Function1<#A, kotlin/Unit>): #B // com.huanshankeji.kotlin/use|use@0:0(kotlin.Function1<0:0,0:1>;kotlin.Function1<0:0,kotlin.Unit>){0§<kotlin.Any?>;1§<kotlin.Any?>}[0] | ||
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?> com.huanshankeji/lambdaOf(noinline kotlin/Function1<#A, #B>): kotlin/Function1<#A, #B> // com.huanshankeji/lambdaOf|lambdaOf(kotlin.Function1<0:0,0:1>){0§<kotlin.Any?>;1§<kotlin.Any?>}[0] | ||
|
@@ -72,6 +81,8 @@ final inline fun <#A: kotlin/Any?, #B: kotlin/Comparable<#B>> (kotlin.collection | |
final inline fun <#A: kotlin/Any?, #B: kotlin/Comparable<#B>> (kotlin.sequences/Sequence<#A>).com.huanshankeji.sequences/isSortedBy(crossinline kotlin/Function1<#A, #B?>): kotlin/Boolean // com.huanshankeji.sequences/isSortedBy|[email protected]<0:0>(kotlin.Function1<0:0,0:1?>){0§<kotlin.Any?>;1§<kotlin.Comparable<0:1>>}[0] | ||
final inline fun <#A: kotlin/Any?, #B: kotlin/Comparable<#B>> (kotlin.sequences/Sequence<#A>).com.huanshankeji.sequences/isSortedByDescending(crossinline kotlin/Function1<#A, #B?>): kotlin/Boolean // com.huanshankeji.sequences/isSortedByDescending|[email protected]<0:0>(kotlin.Function1<0:0,0:1?>){0§<kotlin.Any?>;1§<kotlin.Comparable<0:1>>}[0] | ||
final inline fun <#A: kotlin/Any?> (#A).com.huanshankeji.kotlin/closeFinally(kotlin/Throwable?, kotlin/Function1<#A, kotlin/Unit>) // com.huanshankeji.kotlin/closeFinally|closeFinally@0:0(kotlin.Throwable?;kotlin.Function1<0:0,kotlin.Unit>){0§<kotlin.Any?>}[0] | ||
final inline fun <#A: kotlin/Any?> (kotlin/Function1<#A, kotlin/Unit>?).com.huanshankeji.kotlin.function.parametertypeparameter/plus(noinline kotlin/Function1<#A, kotlin/Unit>?): kotlin/Function1<#A, kotlin/Unit>? // com.huanshankeji.kotlin.function.parametertypeparameter/plus|[email protected]<0:0,kotlin.Unit>?(kotlin.Function1<0:0,kotlin.Unit>?){0§<kotlin.Any?>}[0] | ||
final inline fun <#A: kotlin/Any?> (kotlin/Function1<#A, kotlin/Unit>?).com.huanshankeji.kotlin.function.receivertypeparameter/plus(noinline kotlin/Function1<#A, kotlin/Unit>?): kotlin/Function1<#A, kotlin/Unit>? // com.huanshankeji.kotlin.function.receivertypeparameter/plus|[email protected]<0:0,kotlin.Unit>?(kotlin.Function1<0:0,kotlin.Unit>?){0§<kotlin.Any?>}[0] | ||
final inline fun <#A: kotlin/Comparable<#A>> (kotlin.collections/Iterable<#A>).com.huanshankeji.collections/isSorted(): kotlin/Boolean // com.huanshankeji.collections/isSorted|[email protected]<0:0>(){0§<kotlin.Comparable<0:0>>}[0] | ||
final inline fun <#A: kotlin/Comparable<#A>> (kotlin.collections/Iterable<#A>).com.huanshankeji.collections/isSortedDescending(): kotlin/Boolean // com.huanshankeji.collections/isSortedDescending|[email protected]<0:0>(){0§<kotlin.Comparable<0:0>>}[0] | ||
final inline fun <#A: kotlin/Comparable<#A>> (kotlin.sequences/Sequence<#A>).com.huanshankeji.sequences/isSorted(): kotlin/Boolean // com.huanshankeji.sequences/isSorted|[email protected]<0:0>(){0§<kotlin.Comparable<0:0>>}[0] | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,10 @@ | |
// - Show declarations: true | ||
|
||
// Library unique name: <com.huanshankeji:kotlin-common-coroutines> | ||
abstract fun interface com.huanshankeji.kotlinx.coroutine/CoroutineAutoCloseable { // com.huanshankeji.kotlinx.coroutine/CoroutineAutoCloseable|null[0] | ||
abstract suspend fun close() // com.huanshankeji.kotlinx.coroutine/CoroutineAutoCloseable.close|close(){}[0] | ||
} | ||
|
||
abstract interface com.huanshankeji.kotlinx.coroutine/WithCoroutineScope { // com.huanshankeji.kotlinx.coroutine/WithCoroutineScope|null[0] | ||
abstract val coroutineScope // com.huanshankeji.kotlinx.coroutine/WithCoroutineScope.coroutineScope|{}coroutineScope[0] | ||
abstract fun <get-coroutineScope>(): kotlinx.coroutines/CoroutineScope // com.huanshankeji.kotlinx.coroutine/WithCoroutineScope.coroutineScope.<get-coroutineScope>|<get-coroutineScope>(){}[0] | ||
|
@@ -16,3 +20,4 @@ final suspend fun <#A: kotlin/Any?> (kotlin.collections/Collection<kotlinx.corou | |
final suspend fun <#A: kotlin/Any?> (kotlin.collections/Collection<kotlinx.coroutines/Deferred<#A>>).com.huanshankeji.kotlinx.coroutine/awaitAnyAndCancelOthers(): #A // com.huanshankeji.kotlinx.coroutine/awaitAnyAndCancelOthers|[email protected]<kotlinx.coroutines.Deferred<0:0>>(){0§<kotlin.Any?>}[0] | ||
final suspend fun <#A: kotlin/Any?> com.huanshankeji.kotlinx.coroutine/awaitAny(kotlin/Array<out kotlinx.coroutines/Deferred<#A>>...): #A // com.huanshankeji.kotlinx.coroutine/awaitAny|awaitAny(kotlin.Array<out|kotlinx.coroutines.Deferred<0:0>>...){0§<kotlin.Any?>}[0] | ||
final suspend fun com.huanshankeji.kotlinx.coroutine/joinAny(kotlin/Array<out kotlinx.coroutines/Job>...) // com.huanshankeji.kotlinx.coroutine/joinAny|joinAny(kotlin.Array<out|kotlinx.coroutines.Job>...){}[0] | ||
final suspend inline fun <#A: com.huanshankeji.kotlinx.coroutine/CoroutineAutoCloseable?, #B: kotlin/Any?> (#A).com.huanshankeji.kotlinx.coroutine/use(kotlin/Function1<#A, #B>): #B // com.huanshankeji.kotlinx.coroutine/use|use@0:0(kotlin.Function1<0:0,0:1>){0§<com.huanshankeji.kotlinx.coroutine.CoroutineAutoCloseable?>;1§<kotlin.Any?>}[0] |
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.