Malefic Extensions accelerates Kotlin Multiplatform and Compose projects with a curated toolkit of pragmatic extensions. Ship faster by relying on:
-
KMP-first coverage – Android, JVM, JS, Native, and Web source sets share the same APIs.
-
Compose-aware utilities – Dedicated helpers for system trays, menus, and
Modifierergonomics. -
Battle-tested primitives – Collections, math helpers, tuples, lazy sequences, and safe function composition.
| Artifact | Targets | Notes |
|---|---|---|
|
commonMain, androidMain, jvmMain (Desktop), iosX64/Arm64, iosSimulatorArm64, js (browser + node), wasmJs |
Single multiplatform bundle that includes core language utilities plus Compose-aware helpers on the targets that support them. |
Need a refresher on the code layout? Start with extensions/src/commonMain/….
| Category | Highlights |
|---|---|
|
Nullability helpers and fluent predicates for |
|
Boolean combinators ( |
|
|
|
Memoization ( |
|
Lightweight lazy list builder for streamed evaluation. |
|
Compose |
|
Infix math DSL, factorial/triangular sequences, prime and gcd utilities. |
|
|
|
Extended tuples (Triple → Decuple) with destructuring support. |
|
Compose Desktop tray/menu helpers ( |
|
File-tree builders, stream transformations, and string predicates. |
Add the single artifact wherever you need it. Replace $version with the desired release (see releases or git tag -l).
// settings.gradle.kts
dependencyResolutionManagement {
repositories {
mavenCentral()
}
}kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation("xyz.malefic:extensions:$version")
}
}
val jvmMain by getting {
dependencies {
// Compose dependencies remain yours to configure
implementation(compose.desktop.currentOs)
}
}
}
}Compose-aware helpers (tray/menu, Modifier, etc.) live in the same artifact—just add the Compose runtime/foundation dependencies to the targets where you use them.
// Function composition DSL
val increment = { x: Int -> x + 1 }
val double = { x: Int -> x * 2 }
val pipeline = increment andThen double
val composed = pipeline(3) // 8
// Numeric helpers
val factorial = 5.factorial() // 120
val triangular = 7.triangular() // 28
val isPrime = 97.isPrime() // true
// String predicates
val containsAny = "Hello World".containsAny("Hello", "Goodbye") // true// Tray + menu setup (Compose Desktop)
ApplicationScope.tray {
icon = painterResource("icon.png")
tooltip = "My Application"
onAction = { println("Tray clicked") }
menu {
Item("Settings") { openSettings() }
Item("Exit") { exitApplication() }
}
}
// Modifier helpers
Box(
modifier = Modifier
.showIf(isVisible)
.roundedBackgroundWithPadding(Color.Gray, 8.dp, 16.dp)
.clickableIf(isEnabled) { handleClick() }
)-
Browse the source:
extensions/src/…. -
Dokka HTML is generated via
./gradlew dokkaGenerateModuleHtmland published underbuild/dokka. -
Issues and questions: open a GitHub issue with reproduction steps and target platform info.
-
Fork, branch (
feature/my-improvement), and keep changes scoped. -
Add or update tests/examples alongside new extensions.
-
Run
./gradlew build(plusdokkaGenerateModuleHtmlif docs change) before opening a PR. -
Describe intent, affected modules, and testing notes in the pull request template.
Malefic Extensions is distributed under the MIT License. See LICENSE for the full text.