diff --git a/kyo-bench/src/main/scala/kyo/bench/TRefMultiBench.scala b/kyo-bench/src/main/scala/kyo/bench/TRefMultiBench.scala index 26e17b14c..964553ae4 100644 --- a/kyo-bench/src/main/scala/kyo/bench/TRefMultiBench.scala +++ b/kyo-bench/src/main/scala/kyo/bench/TRefMultiBench.scala @@ -1,7 +1,5 @@ package kyo.bench -import java.util.concurrent.locks.LockSupport - class TRefMultiBench(parallelism: Int) extends Bench.ForkOnly(parallelism): def this() = this(Runtime.getRuntime().availableProcessors() * 2) diff --git a/kyo-bench/src/main/scala/kyo/bench/TRefSingleBench.scala b/kyo-bench/src/main/scala/kyo/bench/TRefSingleBench.scala index 305a149f4..f386d0a58 100644 --- a/kyo-bench/src/main/scala/kyo/bench/TRefSingleBench.scala +++ b/kyo-bench/src/main/scala/kyo/bench/TRefSingleBench.scala @@ -1,7 +1,5 @@ package kyo.bench -import java.util.concurrent.locks.LockSupport - class TRefSingleBench(parallelism: Int) extends Bench.ForkOnly(parallelism): def this() = this(Runtime.getRuntime().availableProcessors() * 2) diff --git a/kyo-cats/shared/src/main/scala/kyo/Cats.scala b/kyo-cats/shared/src/main/scala/kyo/Cats.scala index ce67df9cf..d3316d910 100644 --- a/kyo-cats/shared/src/main/scala/kyo/Cats.scala +++ b/kyo-cats/shared/src/main/scala/kyo/Cats.scala @@ -5,7 +5,6 @@ import kyo.kernel.* import scala.concurrent.ExecutionContext import scala.util.Failure import scala.util.Success -import scala.util.control.NonFatal object Cats: diff --git a/kyo-combinators/shared/src/main/scala/kyo/Combinators.scala b/kyo-combinators/shared/src/main/scala/kyo/Combinators.scala index 6c071b57c..8ffbe00c2 100644 --- a/kyo-combinators/shared/src/main/scala/kyo/Combinators.scala +++ b/kyo-combinators/shared/src/main/scala/kyo/Combinators.scala @@ -2,7 +2,6 @@ package kyo import kyo.debug.Debug import kyo.kernel.Boundary -import kyo.kernel.Reducible import scala.annotation.tailrec import scala.annotation.targetName import scala.util.NotGiven diff --git a/kyo-combinators/shared/src/main/scala/kyo/Constructors.scala b/kyo-combinators/shared/src/main/scala/kyo/Constructors.scala index a33895e71..460be444c 100644 --- a/kyo-combinators/shared/src/main/scala/kyo/Constructors.scala +++ b/kyo-combinators/shared/src/main/scala/kyo/Constructors.scala @@ -1,8 +1,6 @@ package kyo import java.io.IOException -import kyo.kernel.Reducible -import scala.annotation.tailrec import scala.concurrent.Future import scala.util.Failure import scala.util.NotGiven diff --git a/kyo-combinators/shared/src/test/scala/kyo/AbortCombinatorTest.scala b/kyo-combinators/shared/src/test/scala/kyo/AbortCombinatorTest.scala index 5cbf34a9d..c6c3e6cd9 100644 --- a/kyo-combinators/shared/src/test/scala/kyo/AbortCombinatorTest.scala +++ b/kyo-combinators/shared/src/test/scala/kyo/AbortCombinatorTest.scala @@ -1,6 +1,5 @@ package kyo -import scala.concurrent.Future import scala.util.Try class AbortCombinatorTest extends Test: diff --git a/kyo-core/jvm-native/src/main/scala/kyo/KyoAppPlatformSpecific.scala b/kyo-core/jvm-native/src/main/scala/kyo/KyoAppPlatformSpecific.scala index 59cc6ae00..9c75eb3bb 100644 --- a/kyo-core/jvm-native/src/main/scala/kyo/KyoAppPlatformSpecific.scala +++ b/kyo-core/jvm-native/src/main/scala/kyo/KyoAppPlatformSpecific.scala @@ -1,7 +1,5 @@ package kyo -import scala.collection.mutable.ListBuffer - abstract class KyoAppPlatformSpecific extends KyoApp.Base[Async & Resource & Abort[Throwable]]: final override protected def run[A: Flat](v: => A < (Async & Resource & Abort[Throwable]))(using Frame): Unit = diff --git a/kyo-core/jvm/src/test/scala/kyo/internal/SignalTest.scala b/kyo-core/jvm/src/test/scala/kyo/internal/SignalTest.scala index 946c81175..8930884ff 100644 --- a/kyo-core/jvm/src/test/scala/kyo/internal/SignalTest.scala +++ b/kyo-core/jvm/src/test/scala/kyo/internal/SignalTest.scala @@ -3,7 +3,6 @@ package kyo.internal import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit import kyo.Test -import kyo.kernel.Platform class SignalTest extends Test: diff --git a/kyo-core/native/src/main/scala/kyo/hubsStubs.scala b/kyo-core/native/src/main/scala/kyo/hubsStubs.scala index 0e4f84505..164bdd13c 100644 --- a/kyo-core/native/src/main/scala/kyo/hubsStubs.scala +++ b/kyo-core/native/src/main/scala/kyo/hubsStubs.scala @@ -1,7 +1,6 @@ package java.util.concurrent import java.util.function.Predicate -import kyo.discard import scala.collection.mutable import scala.reflect.ClassTag diff --git a/kyo-core/native/src/main/scala/kyo/queuesStubs.scala b/kyo-core/native/src/main/scala/kyo/queuesStubs.scala index 8711866a0..1cdd06bd8 100644 --- a/kyo-core/native/src/main/scala/kyo/queuesStubs.scala +++ b/kyo-core/native/src/main/scala/kyo/queuesStubs.scala @@ -1,7 +1,5 @@ package org.jctools.queues -import java.util.ArrayDeque -import java.util.concurrent.ArrayBlockingQueue import java.util.concurrent.LinkedBlockingQueue import scala.annotation.tailrec diff --git a/kyo-core/shared/src/main/scala/kyo/Channel.scala b/kyo-core/shared/src/main/scala/kyo/Channel.scala index 75ba6cc98..e8678d273 100644 --- a/kyo-core/shared/src/main/scala/kyo/Channel.scala +++ b/kyo-core/shared/src/main/scala/kyo/Channel.scala @@ -1,6 +1,5 @@ package kyo -import org.jctools.queues.MessagePassingQueue.Consumer import org.jctools.queues.MpmcUnboundedXaddArrayQueue import scala.annotation.tailrec diff --git a/kyo-core/shared/src/main/scala/kyo/Fiber.scala b/kyo-core/shared/src/main/scala/kyo/Fiber.scala index 1484882f1..78784f542 100644 --- a/kyo-core/shared/src/main/scala/kyo/Fiber.scala +++ b/kyo-core/shared/src/main/scala/kyo/Fiber.scala @@ -4,12 +4,11 @@ export Fiber.Promise import java.lang.invoke.VarHandle import java.util.Arrays import kyo.Result.Panic -import kyo.Tag import kyo.internal.FiberPlatformSpecific import kyo.kernel.* +import kyo.kernel.internal.* import kyo.scheduler.* import scala.annotation.tailrec -import scala.collection.immutable.ArraySeq import scala.concurrent.ExecutionContext import scala.concurrent.Future import scala.util.NotGiven diff --git a/kyo-core/shared/src/main/scala/kyo/IO.scala b/kyo-core/shared/src/main/scala/kyo/IO.scala index 35a60482c..b98ccdd3f 100644 --- a/kyo-core/shared/src/main/scala/kyo/IO.scala +++ b/kyo-core/shared/src/main/scala/kyo/IO.scala @@ -2,6 +2,7 @@ package kyo import kyo.Tag import kyo.kernel.* +import kyo.kernel.internal.Safepoint /** Represents an IO effect for handling side effects in a pure functional manner. * diff --git a/kyo-core/shared/src/main/scala/kyo/System.scala b/kyo-core/shared/src/main/scala/kyo/System.scala index 01c6b2af7..a8741c0c7 100644 --- a/kyo-core/shared/src/main/scala/kyo/System.scala +++ b/kyo-core/shared/src/main/scala/kyo/System.scala @@ -5,7 +5,6 @@ import java.lang.System as JSystem import java.net.MalformedURLException import java.net.URISyntaxException import java.time.format.DateTimeParseException -import kyo.kernel.Reducible /** Represents a system environment with various operations. * diff --git a/kyo-core/shared/src/main/scala/kyo/Timeout.scala b/kyo-core/shared/src/main/scala/kyo/Timeout.scala index 29ff95591..22f7aa5d0 100644 --- a/kyo-core/shared/src/main/scala/kyo/Timeout.scala +++ b/kyo-core/shared/src/main/scala/kyo/Timeout.scala @@ -1,5 +1,3 @@ package kyo -import scala.util.control.NoStackTrace - class Timeout()(using Frame) extends KyoException(t"Computation has timed out.") diff --git a/kyo-core/shared/src/main/scala/kyo/scheduler/IOPromise.scala b/kyo-core/shared/src/main/scala/kyo/scheduler/IOPromise.scala index 8b4cdb25f..8c39359ce 100644 --- a/kyo-core/shared/src/main/scala/kyo/scheduler/IOPromise.scala +++ b/kyo-core/shared/src/main/scala/kyo/scheduler/IOPromise.scala @@ -5,11 +5,10 @@ import java.util.concurrent.atomic.AtomicReference import java.util.concurrent.locks.LockSupport import kyo.* import kyo.Result.Error -import kyo.kernel.Safepoint +import kyo.kernel.internal.Safepoint import scala.annotation.nowarn import scala.annotation.tailrec import scala.util.control.NonFatal -import scala.util.control.NoStackTrace private[kyo] class IOPromise[+E, +A](init: State[E, A]) extends Safepoint.Interceptor: diff --git a/kyo-core/shared/src/main/scala/kyo/scheduler/IOTask.scala b/kyo-core/shared/src/main/scala/kyo/scheduler/IOTask.scala index 36278f91e..d42c17a65 100644 --- a/kyo-core/shared/src/main/scala/kyo/scheduler/IOTask.scala +++ b/kyo-core/shared/src/main/scala/kyo/scheduler/IOTask.scala @@ -4,6 +4,7 @@ import kyo.* import kyo.Tag import kyo.kernel.* import kyo.kernel.ArrowEffect +import kyo.kernel.internal.* import kyo.scheduler.IOTask.* import scala.util.control.NonFatal diff --git a/kyo-core/shared/src/test/scala/kyo/KyoAppTest.scala b/kyo-core/shared/src/test/scala/kyo/KyoAppTest.scala index 4c1892d07..2ee4b26cd 100644 --- a/kyo-core/shared/src/test/scala/kyo/KyoAppTest.scala +++ b/kyo-core/shared/src/test/scala/kyo/KyoAppTest.scala @@ -1,10 +1,6 @@ package kyo import Tagged.* -import kyo.Clock.Deadline -import kyo.Clock.Stopwatch -import kyo.Clock.Unsafe -import kyo.internal.LayerMacros.Validated.succeed import org.scalatest.compatible.Assertion import scala.collection.mutable.ListBuffer import scala.util.Try diff --git a/kyo-core/shared/src/test/scala/kyo/kernel/TagCompactTest.scala b/kyo-core/shared/src/test/scala/kyo/kernel/TagCompactTest.scala index d2c6ccbae..17b02af46 100644 --- a/kyo-core/shared/src/test/scala/kyo/kernel/TagCompactTest.scala +++ b/kyo-core/shared/src/test/scala/kyo/kernel/TagCompactTest.scala @@ -2,7 +2,6 @@ package kyo.kernel import kyo.* import kyo.kernel.internal.Defer -import org.scalatest.NonImplicitAssertions import org.scalatest.compatible.Assertion class TagCompactTest extends Test: diff --git a/kyo-data/shared/src/main/scala/kyo/Chunk.scala b/kyo-data/shared/src/main/scala/kyo/Chunk.scala index ff983c769..da99a1290 100644 --- a/kyo-data/shared/src/main/scala/kyo/Chunk.scala +++ b/kyo-data/shared/src/main/scala/kyo/Chunk.scala @@ -1,7 +1,6 @@ package kyo import Chunk.Indexed -import java.util.Arrays import scala.annotation.tailrec import scala.annotation.targetName import scala.collection.StrictOptimizedSeqFactory diff --git a/kyo-data/shared/src/main/scala/kyo/Render.scala b/kyo-data/shared/src/main/scala/kyo/Render.scala index aa18bf910..fdf6a3e6b 100644 --- a/kyo-data/shared/src/main/scala/kyo/Render.scala +++ b/kyo-data/shared/src/main/scala/kyo/Render.scala @@ -1,6 +1,5 @@ package kyo -import kyo.Schedule.done import scala.annotation.nowarn import scala.language.implicitConversions diff --git a/kyo-data/shared/src/main/scala/kyo/internal/TagMacro.scala b/kyo-data/shared/src/main/scala/kyo/internal/TagMacro.scala index 4172c3bbb..6b4de2d29 100644 --- a/kyo-data/shared/src/main/scala/kyo/internal/TagMacro.scala +++ b/kyo-data/shared/src/main/scala/kyo/internal/TagMacro.scala @@ -133,42 +133,42 @@ object TagMacro: end concat val toCompact = Map( - "java.lang.Object" -> "0", - "scala.Matchable" -> "1", - "scala.Any" -> "2", - "scala.AnyVal" -> "3", - "java.lang.String" -> "4", - "scala.Int" -> "5", - "scala.Long" -> "6", - "scala.Float" -> "7", - "scala.Double" -> "8", - "scala.Boolean" -> "9", - "scala.Unit" -> "a", - "scala.Option" -> "b", - "scala.Some" -> "c", - "scala.None" -> "d", - "scala.Left" -> "e", - "scala.Right" -> "f", - "scala.Tuple2" -> "g", - "scala.collection.immutable.List" -> "h", - "scala.collection.immutable.Nil" -> "i", - "scala.collection.immutable.Map" -> "j", - "scala.Nothing" -> "k", - "java.lang.CharSequence" -> "l", - "java.lang.Comparable" -> "m", - "java.io.Serializable" -> "n", - "scala.Product" -> "o", - "scala.Equals" -> "p", - "kyo.kernel.Effect" -> "q", - "kyo.kernel.ContextEffect" -> "r", - "kyo.kernel.ArrowEffect" -> "s", - "kyo.Abort" -> "t", - "kyo.Async$package$.Async$.Join" -> "u", - "kyo.Emit" -> "v", - "scala.Char" -> "w", - "java.lang.Throwable" -> "x", - "java.lang.Exception" -> "y", - "kyo.kernel.package$.internal$.Defer" -> "z" + "java.lang.Object" -> "0", + "scala.Matchable" -> "1", + "scala.Any" -> "2", + "scala.AnyVal" -> "3", + "java.lang.String" -> "4", + "scala.Int" -> "5", + "scala.Long" -> "6", + "scala.Float" -> "7", + "scala.Double" -> "8", + "scala.Boolean" -> "9", + "scala.Unit" -> "a", + "scala.Option" -> "b", + "scala.Some" -> "c", + "scala.None" -> "d", + "scala.Left" -> "e", + "scala.Right" -> "f", + "scala.Tuple2" -> "g", + "scala.collection.immutable.List" -> "h", + "scala.collection.immutable.Nil" -> "i", + "scala.collection.immutable.Map" -> "j", + "scala.Nothing" -> "k", + "java.lang.CharSequence" -> "l", + "java.lang.Comparable" -> "m", + "java.io.Serializable" -> "n", + "scala.Product" -> "o", + "scala.Equals" -> "p", + "kyo.kernel.Effect" -> "q", + "kyo.kernel.ContextEffect" -> "r", + "kyo.kernel.ArrowEffect" -> "s", + "kyo.Abort" -> "t", + "kyo.Async$package$.Async$.Join" -> "u", + "kyo.Emit" -> "v", + "scala.Char" -> "w", + "java.lang.Throwable" -> "x", + "java.lang.Exception" -> "y", + "kyo.kernel.internal.Defer" -> "z" ) val fromCompact = toCompact.map(_.swap).toMap diff --git a/kyo-data/shared/src/test/scala/kyo/MaybeTest.scala b/kyo-data/shared/src/test/scala/kyo/MaybeTest.scala index 42cd9b785..6e8768f11 100644 --- a/kyo-data/shared/src/test/scala/kyo/MaybeTest.scala +++ b/kyo-data/shared/src/test/scala/kyo/MaybeTest.scala @@ -2,7 +2,6 @@ package kyo import kyo.Maybe.* import kyo.Maybe.internal.PresentAbsent -import scala.languageFeature.implicitConversions class MaybeTest extends Test: diff --git a/kyo-data/shared/src/test/scala/kyo/Test.scala b/kyo-data/shared/src/test/scala/kyo/Test.scala index f21a22c49..ee4406c04 100644 --- a/kyo-data/shared/src/test/scala/kyo/Test.scala +++ b/kyo-data/shared/src/test/scala/kyo/Test.scala @@ -3,7 +3,6 @@ package kyo import org.scalatest.Assertion import org.scalatest.NonImplicitAssertions import org.scalatest.freespec.AsyncFreeSpec -import scala.compiletime.testing.Error import scala.compiletime.testing.typeCheckErrors import scala.util.Try diff --git a/kyo-kernel/js/src/main/scala/kyo/kernel/TracePool.scala b/kyo-kernel/js/src/main/scala/kyo/kernel/internal/TracePool.scala similarity index 96% rename from kyo-kernel/js/src/main/scala/kyo/kernel/TracePool.scala rename to kyo-kernel/js/src/main/scala/kyo/kernel/internal/TracePool.scala index 6c7f07bf1..8071cd8a0 100644 --- a/kyo-kernel/js/src/main/scala/kyo/kernel/TracePool.scala +++ b/kyo-kernel/js/src/main/scala/kyo/kernel/internal/TracePool.scala @@ -1,6 +1,5 @@ -package kyo.kernel +package kyo.kernel.internal -import internal.* import kyo.Frame private[kernel] object TracePool: diff --git a/kyo-kernel/jvm/src/main/scala/kyo/kernel/Platform.scala b/kyo-kernel/jvm/src/main/scala/kyo/kernel/Platform.scala index b194c568a..d866c5142 100644 --- a/kyo-kernel/jvm/src/main/scala/kyo/kernel/Platform.scala +++ b/kyo-kernel/jvm/src/main/scala/kyo/kernel/Platform.scala @@ -1,14 +1,9 @@ package kyo.kernel -import kyo.kernel.Mode import scala.concurrent.ExecutionContext object Platform: - val mode: Mode = - Option(System.getProperty("kyo.kernel.Platform.mode")) - .map(Mode.valueOf).getOrElse(Mode.Development) - val executionContext: ExecutionContext = scala.concurrent.ExecutionContext.global val isJVM: Boolean = true val isJS: Boolean = false diff --git a/kyo-kernel/jvm/src/main/scala/kyo/kernel/TracePool.scala b/kyo-kernel/jvm/src/main/scala/kyo/kernel/internal/TracePool.scala similarity index 96% rename from kyo-kernel/jvm/src/main/scala/kyo/kernel/TracePool.scala rename to kyo-kernel/jvm/src/main/scala/kyo/kernel/internal/TracePool.scala index 9d7d96810..61f83a9e6 100644 --- a/kyo-kernel/jvm/src/main/scala/kyo/kernel/TracePool.scala +++ b/kyo-kernel/jvm/src/main/scala/kyo/kernel/internal/TracePool.scala @@ -1,7 +1,7 @@ -package kyo.kernel +package kyo.kernel.internal -import internal.* import java.util.Arrays +import kyo.kernel.internal.* import org.jctools.queues.MessagePassingQueue.Consumer import org.jctools.queues.MpmcArrayQueue diff --git a/kyo-kernel/jvm/src/test/scala/kyo/kernel/SafepointTest.scala b/kyo-kernel/jvm/src/test/scala/kyo/kernel/internal/SafepointTest.scala similarity index 99% rename from kyo-kernel/jvm/src/test/scala/kyo/kernel/SafepointTest.scala rename to kyo-kernel/jvm/src/test/scala/kyo/kernel/internal/SafepointTest.scala index 95bd47b47..d17531c49 100644 --- a/kyo-kernel/jvm/src/test/scala/kyo/kernel/SafepointTest.scala +++ b/kyo-kernel/jvm/src/test/scala/kyo/kernel/internal/SafepointTest.scala @@ -1,8 +1,9 @@ -package kyo.kernel +package kyo.kernel.internal import kyo.* import kyo.Tag import kyo.Tagged.* +import kyo.kernel.* import scala.concurrent.Await import scala.concurrent.Future diff --git a/kyo-kernel/native/src/main/scala/kyo/kernel/Platform.scala b/kyo-kernel/native/src/main/scala/kyo/kernel/Platform.scala index d60994e06..1cd2c9ef2 100644 --- a/kyo-kernel/native/src/main/scala/kyo/kernel/Platform.scala +++ b/kyo-kernel/native/src/main/scala/kyo/kernel/Platform.scala @@ -1,14 +1,9 @@ package kyo.kernel -import kyo.kernel.Mode import scala.concurrent.ExecutionContext object Platform: - val mode: Mode = - Option(System.getProperty("kyo.kernel.Platform.mode")) - .map(Mode.valueOf).getOrElse(Mode.Development) - val executionContext: ExecutionContext = scala.concurrent.ExecutionContext.global val isJVM: Boolean = false val isJS: Boolean = false diff --git a/kyo-kernel/native/src/main/scala/kyo/kernel/TracePool.scala b/kyo-kernel/native/src/main/scala/kyo/kernel/internal/TracePool.scala similarity index 91% rename from kyo-kernel/native/src/main/scala/kyo/kernel/TracePool.scala rename to kyo-kernel/native/src/main/scala/kyo/kernel/internal/TracePool.scala index b54a374b1..3efc70cc8 100644 --- a/kyo-kernel/native/src/main/scala/kyo/kernel/TracePool.scala +++ b/kyo-kernel/native/src/main/scala/kyo/kernel/internal/TracePool.scala @@ -1,11 +1,8 @@ -package kyo.kernel +package kyo.kernel.internal -import internal.* import java.util.Arrays import java.util.concurrent.ConcurrentLinkedQueue -import java.util.concurrent.atomic.AtomicInteger import kyo.discard -import scala.annotation.tailrec private[kernel] object TracePool: inline def globalCapacity: Int = 8192 diff --git a/kyo-kernel/shared/src/main/scala/kyo/Kyo.scala b/kyo-kernel/shared/src/main/scala/kyo/Kyo.scala index c9be08e72..c85a6650f 100644 --- a/kyo-kernel/shared/src/main/scala/kyo/Kyo.scala +++ b/kyo-kernel/shared/src/main/scala/kyo/Kyo.scala @@ -1,7 +1,7 @@ package kyo import kernel.Loop -import kyo.kernel.Safepoint +import kyo.kernel.internal.Safepoint import scala.annotation.tailrec /** Object containing utility functions for working with Kyo effects. */ diff --git a/kyo-kernel/shared/src/main/scala/kyo/kernel/ArrowEffect.scala b/kyo-kernel/shared/src/main/scala/kyo/kernel/ArrowEffect.scala index ec49d788e..97940eb5b 100644 --- a/kyo-kernel/shared/src/main/scala/kyo/kernel/ArrowEffect.scala +++ b/kyo-kernel/shared/src/main/scala/kyo/kernel/ArrowEffect.scala @@ -1,10 +1,7 @@ package kyo.kernel -import internal.* -import kyo.Const -import kyo.Flat -import kyo.Frame -import kyo.Tag +import kyo.* +import kyo.kernel.internal.* import scala.annotation.nowarn import scala.util.control.NonFatal diff --git a/kyo-kernel/shared/src/main/scala/kyo/kernel/Boundary.scala b/kyo-kernel/shared/src/main/scala/kyo/kernel/Boundary.scala index 5bd2284b1..7ca2fe2f5 100644 --- a/kyo-kernel/shared/src/main/scala/kyo/kernel/Boundary.scala +++ b/kyo-kernel/shared/src/main/scala/kyo/kernel/Boundary.scala @@ -1,9 +1,8 @@ package kyo.kernel -import internal.* import kyo.Ansi.* import kyo.Frame -import scala.annotation.implicitNotFound +import kyo.kernel.internal.* import scala.annotation.nowarn import scala.quoted.* diff --git a/kyo-kernel/shared/src/main/scala/kyo/kernel/ContextEffect.scala b/kyo-kernel/shared/src/main/scala/kyo/kernel/ContextEffect.scala index ec55ff2e7..bcfd0a0a9 100644 --- a/kyo-kernel/shared/src/main/scala/kyo/kernel/ContextEffect.scala +++ b/kyo-kernel/shared/src/main/scala/kyo/kernel/ContextEffect.scala @@ -1,12 +1,8 @@ package kyo.kernel -import internal.* -import kyo.Flat -import kyo.Frame -import kyo.Tag -import kyo.bug +import kyo.* +import kyo.kernel.internal.* import scala.annotation.nowarn -import scala.util.NotGiven /** Represents the requirement for a value that will be provided later by a handler. * diff --git a/kyo-kernel/shared/src/main/scala/kyo/kernel/Effect.scala b/kyo-kernel/shared/src/main/scala/kyo/kernel/Effect.scala index 877bd6944..8a87b98af 100644 --- a/kyo-kernel/shared/src/main/scala/kyo/kernel/Effect.scala +++ b/kyo-kernel/shared/src/main/scala/kyo/kernel/Effect.scala @@ -1,7 +1,7 @@ package kyo.kernel -import internal.* import kyo.Frame +import kyo.kernel.internal.* import scala.annotation.nowarn import scala.util.control.NonFatal diff --git a/kyo-kernel/shared/src/main/scala/kyo/kernel/Loop.scala b/kyo-kernel/shared/src/main/scala/kyo/kernel/Loop.scala index 9c722e160..02ef15c88 100644 --- a/kyo-kernel/shared/src/main/scala/kyo/kernel/Loop.scala +++ b/kyo-kernel/shared/src/main/scala/kyo/kernel/Loop.scala @@ -1,8 +1,8 @@ package kyo.kernel -import internal.* -import kyo.Flat +import kyo.* import kyo.Frame +import kyo.kernel.internal.* import scala.annotation.nowarn import scala.annotation.tailrec import scala.annotation.targetName diff --git a/kyo-kernel/shared/src/main/scala/kyo/kernel/Pending.scala b/kyo-kernel/shared/src/main/scala/kyo/kernel/Pending.scala index b3cf4645c..f8b6345f9 100644 --- a/kyo-kernel/shared/src/main/scala/kyo/kernel/Pending.scala +++ b/kyo-kernel/shared/src/main/scala/kyo/kernel/Pending.scala @@ -1,8 +1,7 @@ package kyo.kernel -import internal.* import kyo.* -import kyo.Maybe +import kyo.kernel.internal.* import scala.annotation.nowarn import scala.annotation.tailrec import scala.language.implicitConversions diff --git a/kyo-kernel/shared/src/main/scala/kyo/kernel/Context.scala b/kyo-kernel/shared/src/main/scala/kyo/kernel/internal/Context.scala similarity index 97% rename from kyo-kernel/shared/src/main/scala/kyo/kernel/Context.scala rename to kyo-kernel/shared/src/main/scala/kyo/kernel/internal/Context.scala index 2fac48257..ec69969f3 100644 --- a/kyo-kernel/shared/src/main/scala/kyo/kernel/Context.scala +++ b/kyo-kernel/shared/src/main/scala/kyo/kernel/internal/Context.scala @@ -1,9 +1,10 @@ -package kyo.kernel +package kyo.kernel.internal import Context.internal.* import kyo.Flat import kyo.Tag import kyo.bug +import kyo.kernel.* private[kyo] opaque type Context = Map[Tag[Any], AnyRef] diff --git a/kyo-kernel/shared/src/main/scala/kyo/kernel/internal/Kyo.scala b/kyo-kernel/shared/src/main/scala/kyo/kernel/internal/Kyo.scala new file mode 100644 index 000000000..a4d8d71cb --- /dev/null +++ b/kyo-kernel/shared/src/main/scala/kyo/kernel/internal/Kyo.scala @@ -0,0 +1,34 @@ +package kyo.kernel.internal + +import kyo.< +import kyo.Const +import kyo.Frame +import kyo.Tag +import kyo.kernel.ArrowEffect + +sealed private[kernel] trait Defer extends ArrowEffect[Const[Unit], Const[Unit]] + +sealed abstract private[kernel] class Kyo[+A, -S] + +abstract private[kernel] class KyoSuspend[I[_], O[_], E <: ArrowEffect[I, O], A, B, S] + extends Kyo[B, S]: + def tag: Tag[E] + def input: I[A] + def frame: Frame + + def apply(v: O[A], context: Context)(using Safepoint): B < S + + final override def toString = + s"Kyo(${tag.show}, Input($input), ${frame.position.show}, ${frame.snippetShort})" +end KyoSuspend + +abstract private[kernel] class KyoContinue[I[_], O[_], E <: ArrowEffect[I, O], A, B, S](kyo: KyoSuspend[I, O, E, A, ?, ?]) + extends KyoSuspend[I, O, E, A, B, S]: + val tag = kyo.tag + val input = kyo.input +end KyoContinue + +abstract private[kernel] class KyoDefer[A, S] extends KyoSuspend[Const[Unit], Const[Unit], Defer, Any, A, S]: + final def tag = Tag[Defer] + final def input = () +end KyoDefer diff --git a/kyo-kernel/shared/src/main/scala/kyo/kernel/Safepoint.scala b/kyo-kernel/shared/src/main/scala/kyo/kernel/internal/Safepoint.scala similarity index 99% rename from kyo-kernel/shared/src/main/scala/kyo/kernel/Safepoint.scala rename to kyo-kernel/shared/src/main/scala/kyo/kernel/internal/Safepoint.scala index d84d32f4f..567ce5be1 100644 --- a/kyo-kernel/shared/src/main/scala/kyo/kernel/Safepoint.scala +++ b/kyo-kernel/shared/src/main/scala/kyo/kernel/internal/Safepoint.scala @@ -1,10 +1,10 @@ -package kyo.kernel +package kyo.kernel.internal -import internal.* +import Safepoint.* import java.util.concurrent.atomic.AtomicBoolean import kyo.Frame import kyo.isNull -import kyo.kernel.Safepoint.* +import kyo.kernel.* import scala.annotation.nowarn import scala.util.control.NonFatal diff --git a/kyo-kernel/shared/src/main/scala/kyo/kernel/Trace.scala b/kyo-kernel/shared/src/main/scala/kyo/kernel/internal/Trace.scala similarity index 98% rename from kyo-kernel/shared/src/main/scala/kyo/kernel/Trace.scala rename to kyo-kernel/shared/src/main/scala/kyo/kernel/internal/Trace.scala index cd813a09e..10ec4b3a9 100644 --- a/kyo-kernel/shared/src/main/scala/kyo/kernel/Trace.scala +++ b/kyo-kernel/shared/src/main/scala/kyo/kernel/internal/Trace.scala @@ -1,7 +1,7 @@ -package kyo.kernel +package kyo.kernel.internal -import internal.* import kyo.Frame +import kyo.kernel.internal.* import scala.annotation.tailrec import scala.util.control.NonFatal import scala.util.control.NoStackTrace diff --git a/kyo-kernel/shared/src/main/scala/kyo/kernel/WeakFlat.scala b/kyo-kernel/shared/src/main/scala/kyo/kernel/internal/WeakFlat.scala similarity index 97% rename from kyo-kernel/shared/src/main/scala/kyo/kernel/WeakFlat.scala rename to kyo-kernel/shared/src/main/scala/kyo/kernel/internal/WeakFlat.scala index 3cc3c5fe3..a0d5530d3 100644 --- a/kyo-kernel/shared/src/main/scala/kyo/kernel/WeakFlat.scala +++ b/kyo-kernel/shared/src/main/scala/kyo/kernel/internal/WeakFlat.scala @@ -1,5 +1,6 @@ -package kyo.kernel +package kyo.kernel.internal +import kyo.< import scala.annotation.implicitNotFound import scala.util.NotGiven diff --git a/kyo-kernel/shared/src/main/scala/kyo/kernel/internal/package.scala b/kyo-kernel/shared/src/main/scala/kyo/kernel/internal/package.scala new file mode 100644 index 000000000..477ae62af --- /dev/null +++ b/kyo-kernel/shared/src/main/scala/kyo/kernel/internal/package.scala @@ -0,0 +1,10 @@ +package kyo.kernel.internal + +import kyo.kernel.ArrowEffect + +private[kernel] inline def maxStackDepth = 512 +private[kernel] inline def maxTraceFrames = 16 + +private[kernel] type IX[_] +private[kernel] type OX[_] +private[kernel] type EX <: ArrowEffect[IX, OX] diff --git a/kyo-kernel/shared/src/main/scala/kyo/kernel/package.scala b/kyo-kernel/shared/src/main/scala/kyo/kernel/package.scala deleted file mode 100644 index 9deaf27eb..000000000 --- a/kyo-kernel/shared/src/main/scala/kyo/kernel/package.scala +++ /dev/null @@ -1,45 +0,0 @@ -package kyo - -package object kernel: - - enum Mode derives CanEqual: - case Development, Staging, Production - - private[kernel] object internal: - - inline def maxStackDepth = 512 - inline def maxTraceFrames = 16 - - type IX[_] - type OX[_] - type EX <: ArrowEffect[IX, OX] - - sealed trait Defer extends ArrowEffect[Const[Unit], Const[Unit]] - - sealed abstract class Kyo[+A, -S] - - abstract class KyoSuspend[I[_], O[_], E <: ArrowEffect[I, O], A, B, S] - extends Kyo[B, S]: - def tag: Tag[E] - def input: I[A] - def frame: Frame - - def apply(v: O[A], context: Context)(using Safepoint): B < S - - final override def toString = - s"Kyo(${tag.show}, Input($input), ${frame.position.show}, ${frame.snippetShort})" - end KyoSuspend - - abstract class KyoContinue[I[_], O[_], E <: ArrowEffect[I, O], A, B, S](kyo: KyoSuspend[I, O, E, A, ?, ?]) - extends KyoSuspend[I, O, E, A, B, S]: - val tag = kyo.tag - val input = kyo.input - end KyoContinue - - abstract class KyoDefer[A, S] extends KyoSuspend[Const[Unit], Const[Unit], Defer, Any, A, S]: - final def tag = Tag[Defer] - final def input = () - end KyoDefer - - end internal -end kernel diff --git a/kyo-kernel/shared/src/test/scala/kyo/kernel/ArrowEffectTest.scala b/kyo-kernel/shared/src/test/scala/kyo/kernel/ArrowEffectTest.scala index e66011c08..9f8ba5f6c 100644 --- a/kyo-kernel/shared/src/test/scala/kyo/kernel/ArrowEffectTest.scala +++ b/kyo-kernel/shared/src/test/scala/kyo/kernel/ArrowEffectTest.scala @@ -1,10 +1,8 @@ package kyo.kernel -import kyo.Const -import kyo.Maybe -import kyo.Tag -import kyo.Test +import kyo.* import kyo.kernel.* +import kyo.kernel.internal.* class ArrowEffectTest extends Test: diff --git a/kyo-kernel/shared/src/test/scala/kyo/kernel/BoundaryTest.scala b/kyo-kernel/shared/src/test/scala/kyo/kernel/BoundaryTest.scala index 6e92da621..061fed201 100644 --- a/kyo-kernel/shared/src/test/scala/kyo/kernel/BoundaryTest.scala +++ b/kyo-kernel/shared/src/test/scala/kyo/kernel/BoundaryTest.scala @@ -1,8 +1,7 @@ package kyo.kernel import kyo.* -import kyo.Tag -import kyo.Test +import kyo.kernel.internal.* class BoundaryTest extends Test: diff --git a/kyo-kernel/shared/src/test/scala/kyo/kernel/ContextEffectTest.scala b/kyo-kernel/shared/src/test/scala/kyo/kernel/ContextEffectTest.scala index a328234b2..df229f01e 100644 --- a/kyo-kernel/shared/src/test/scala/kyo/kernel/ContextEffectTest.scala +++ b/kyo-kernel/shared/src/test/scala/kyo/kernel/ContextEffectTest.scala @@ -1,7 +1,6 @@ package kyo.kernel -import kyo.Tag -import kyo.Test +import kyo.* import kyo.kernel.* class RuntimeEffectTest extends Test: diff --git a/kyo-kernel/shared/src/test/scala/kyo/kernel/EffectTest.scala b/kyo-kernel/shared/src/test/scala/kyo/kernel/EffectTest.scala index 21cc0c631..bd35c8b96 100644 --- a/kyo-kernel/shared/src/test/scala/kyo/kernel/EffectTest.scala +++ b/kyo-kernel/shared/src/test/scala/kyo/kernel/EffectTest.scala @@ -1,9 +1,6 @@ package kyo.kernel -import kyo.Const -import kyo.Maybe -import kyo.Tag -import kyo.Test +import kyo.* import kyo.kernel.* class EffectTest extends Test: diff --git a/kyo-kernel/shared/src/test/scala/kyo/kernel/ContextTest.scala b/kyo-kernel/shared/src/test/scala/kyo/kernel/internal/ContextTest.scala similarity index 98% rename from kyo-kernel/shared/src/test/scala/kyo/kernel/ContextTest.scala rename to kyo-kernel/shared/src/test/scala/kyo/kernel/internal/ContextTest.scala index 4b555d8a8..30578ffff 100644 --- a/kyo-kernel/shared/src/test/scala/kyo/kernel/ContextTest.scala +++ b/kyo-kernel/shared/src/test/scala/kyo/kernel/internal/ContextTest.scala @@ -1,7 +1,7 @@ -package kyo.kernel +package kyo.kernel.internal -import kyo.Tag -import kyo.Test +import kyo.* +import kyo.kernel.* class ContextTest extends Test: diff --git a/kyo-kernel/shared/src/test/scala/kyo/kernel/TracePoolTest.scala b/kyo-kernel/shared/src/test/scala/kyo/kernel/internal/TracePoolTest.scala similarity index 98% rename from kyo-kernel/shared/src/test/scala/kyo/kernel/TracePoolTest.scala rename to kyo-kernel/shared/src/test/scala/kyo/kernel/internal/TracePoolTest.scala index ca0e35773..6bda9c486 100644 --- a/kyo-kernel/shared/src/test/scala/kyo/kernel/TracePoolTest.scala +++ b/kyo-kernel/shared/src/test/scala/kyo/kernel/internal/TracePoolTest.scala @@ -1,4 +1,4 @@ -package kyo.kernel +package kyo.kernel.internal import kyo.Frame import kyo.Test diff --git a/kyo-kernel/shared/src/test/scala/kyo/kernel/TraceTest.scala b/kyo-kernel/shared/src/test/scala/kyo/kernel/internal/TraceTest.scala similarity index 67% rename from kyo-kernel/shared/src/test/scala/kyo/kernel/TraceTest.scala rename to kyo-kernel/shared/src/test/scala/kyo/kernel/internal/TraceTest.scala index 67b4a056b..f443ea5d0 100644 --- a/kyo-kernel/shared/src/test/scala/kyo/kernel/TraceTest.scala +++ b/kyo-kernel/shared/src/test/scala/kyo/kernel/internal/TraceTest.scala @@ -1,9 +1,10 @@ -package kyo.kernel +package kyo.kernel.internal import java.io.PrintWriter import java.io.StringWriter import kyo.* import kyo.Tagged.* +import kyo.kernel.* class TraceTest extends Test: @@ -41,9 +42,9 @@ class TraceTest extends Test: evalOnly, """ |java.lang.Exception: test exception - | at kyo.kernel.TraceTest.ex(TraceTest.scala:19) - | at oom[S](x: Int < S): Int < S = x.map(_ => throw ex) @ kyo.kernel.TraceTest.boom(TraceTest.scala:21) - | at def evalOnly = boom(10).eval @ kyo.kernel.TraceTest.evalOnly(TraceTest.scala:23) + | at kyo.kernel.internal.TraceTest.ex(TraceTest.scala:20) + | at oom[S](x: Int < S): Int < S = x.map(_ => throw ex) @ kyo.kernel.internal.TraceTest.boom(TraceTest.scala:22) + | at def evalOnly = boom(10).eval @ kyo.kernel.internal.TraceTest.evalOnly(TraceTest.scala:24) """ ) } @@ -53,15 +54,15 @@ class TraceTest extends Test: withEffects, """ |java.lang.Exception: test exception - | at kyo.kernel.TraceTest.ex(TraceTest.scala:19) - | at oom[S](x: Int < S): Int < S = x.map(_ => throw ex) @ kyo.kernel.TraceTest.boom(TraceTest.scala:21) - | at val z = Kyo.zip(x, y).map(_ + _).map(boom) @ kyo.kernel.TraceTest.withEffects(TraceTest.scala:28) - | at val z = Kyo.zip(x, y).map(_ + _) @ kyo.kernel.TraceTest.withEffects(TraceTest.scala:28) - | at val z = Kyo.zip(x, y) @ kyo.kernel.TraceTest.withEffects(TraceTest.scala:28) - | at ) @ kyo.kernel.TraceTest.TestEffect$.run(TraceTest.scala:16) - | at val z = Kyo.zip(x, y) @ kyo.kernel.TraceTest.withEffects(TraceTest.scala:28) - | at ) @ kyo.kernel.TraceTest.TestEffect$.run(TraceTest.scala:16) - | at TestEffect.run(z).eval @ kyo.kernel.TraceTest.withEffects(TraceTest.scala:29) + | at kyo.kernel.internal.TraceTest.ex(TraceTest.scala:20) + | at oom[S](x: Int < S): Int < S = x.map(_ => throw ex) @ kyo.kernel.internal.TraceTest.boom(TraceTest.scala:22) + | at val z = Kyo.zip(x, y).map(_ + _).map(boom) @ kyo.kernel.internal.TraceTest.withEffects(TraceTest.scala:29) + | at val z = Kyo.zip(x, y).map(_ + _) @ kyo.kernel.internal.TraceTest.withEffects(TraceTest.scala:29) + | at val z = Kyo.zip(x, y) @ kyo.kernel.internal.TraceTest.withEffects(TraceTest.scala:29) + | at ) @ kyo.kernel.internal.TraceTest.TestEffect$.run(TraceTest.scala:17) + | at val z = Kyo.zip(x, y) @ kyo.kernel.internal.TraceTest.withEffects(TraceTest.scala:29) + | at ) @ kyo.kernel.internal.TraceTest.TestEffect$.run(TraceTest.scala:17) + | at TestEffect.run(z).eval @ kyo.kernel.internal.TraceTest.withEffects(TraceTest.scala:30) """ ) } @@ -71,9 +72,9 @@ class TraceTest extends Test: repeatedFrames, """ |java.lang.Exception: test exception - | at kyo.kernel.TraceTest.ex(TraceTest.scala:19) - | at oom[S](x: Int < S): Int < S = x.map(_ => throw ex) @ kyo.kernel.TraceTest.boom(TraceTest.scala:21) - | at else ((depth - 1): Int < Any).map(loop(_)) @ kyo.kernel.TraceTest.loop(TraceTest.scala:34) + | at kyo.kernel.internal.TraceTest.ex(TraceTest.scala:20) + | at oom[S](x: Int < S): Int < S = x.map(_ => throw ex) @ kyo.kernel.internal.TraceTest.boom(TraceTest.scala:22) + | at else ((depth - 1): Int < Any).map(loop(_)) @ kyo.kernel.internal.TraceTest.loop(TraceTest.scala:35) """ ) } @@ -89,9 +90,9 @@ class TraceTest extends Test: evalOnly, """ |java.lang.Exception: test exception - | at kyo.kernel.TraceTest.ex(TraceTest.scala:19) - | at oom[S](x: Int < S): Int < S = x.map(_ => throw ex) @ kyo.kernel.TraceTest.boom(TraceTest.scala:21) - | at def evalOnly = boom(10).eval @ kyo.kernel.TraceTest.evalOnly(TraceTest.scala:23) + | at kyo.kernel.internal.TraceTest.ex(TraceTest.scala:20) + | at oom[S](x: Int < S): Int < S = x.map(_ => throw ex) @ kyo.kernel.internal.TraceTest.boom(TraceTest.scala:22) + | at def evalOnly = boom(10).eval @ kyo.kernel.internal.TraceTest.evalOnly(TraceTest.scala:24) """ ) () @@ -102,31 +103,19 @@ class TraceTest extends Test: withEffects, """ |java.lang.Exception: test exception - | at kyo.kernel.TraceTest.ex(TraceTest.scala:19) - | at oom[S](x: Int < S): Int < S = x.map(_ => throw ex) @ kyo.kernel.TraceTest.boom(TraceTest.scala:21) - | at val z = Kyo.zip(x, y).map(_ + _).map(boom) @ kyo.kernel.TraceTest.withEffects(TraceTest.scala:28) - | at val z = Kyo.zip(x, y).map(_ + _) @ kyo.kernel.TraceTest.withEffects(TraceTest.scala:28) - | at val z = Kyo.zip(x, y) @ kyo.kernel.TraceTest.withEffects(TraceTest.scala:28) - | at ) @ kyo.kernel.TraceTest.TestEffect$.run(TraceTest.scala:16) - | at val z = Kyo.zip(x, y) @ kyo.kernel.TraceTest.withEffects(TraceTest.scala:28) - | at ) @ kyo.kernel.TraceTest.TestEffect$.run(TraceTest.scala:16) - | at TestEffect.run(z).eval @ kyo.kernel.TraceTest.withEffects(TraceTest.scala:29) + | at kyo.kernel.internal.TraceTest.ex(TraceTest.scala:20) + | at oom[S](x: Int < S): Int < S = x.map(_ => throw ex) @ kyo.kernel.internal.TraceTest.boom(TraceTest.scala:22) + | at val z = Kyo.zip(x, y).map(_ + _).map(boom) @ kyo.kernel.internal.TraceTest.withEffects(TraceTest.scala:29) + | at val z = Kyo.zip(x, y).map(_ + _) @ kyo.kernel.internal.TraceTest.withEffects(TraceTest.scala:29) + | at val z = Kyo.zip(x, y) @ kyo.kernel.internal.TraceTest.withEffects(TraceTest.scala:29) + | at ) @ kyo.kernel.internal.TraceTest.TestEffect$.run(TraceTest.scala:17) + | at val z = Kyo.zip(x, y) @ kyo.kernel.internal.TraceTest.withEffects(TraceTest.scala:29) + | at ) @ kyo.kernel.internal.TraceTest.TestEffect$.run(TraceTest.scala:17) + | at TestEffect.run(z).eval @ kyo.kernel.internal.TraceTest.withEffects(TraceTest.scala:30) """ ) () } - - "repeated frames" taggedAs jvmOnly in { - assertTrace( - repeatedFrames, - """ - |java.lang.Exception: test exception - | at kyo.kernel.TraceTest.ex(TraceTest.scala:19) - | at oom[S](x: Int < S): Int < S = x.map(_ => throw ex) @ kyo.kernel.TraceTest.boom(TraceTest.scala:21) - | at else ((depth - 1): Int < Any).map(loop(_)) @ kyo.kernel.TraceTest.loop(TraceTest.scala:34) - """ - ) - } } "no trace if exception is NoStackTrace" - { @@ -134,7 +123,7 @@ class TraceTest extends Test: import scala.util.control.NoStackTrace assertTrace( throw new NoStackTrace {}, - "kyo.kernel.TraceTest$$anon$1" + "kyo.kernel.internal.TraceTest$$anon$1" ) } "js" taggedAs jsOnly in { @@ -142,7 +131,7 @@ class TraceTest extends Test: assertTrace( throw new NoStackTrace {}, """ - |kyo.kernel.TraceTest$$anon$2 + |kyo.kernel.internal.TraceTest$$anon$2 | """ ) diff --git a/kyo-kernel/shared/src/test/scala/kyo/kernel/WeakFlatTest.scala b/kyo-kernel/shared/src/test/scala/kyo/kernel/internal/WeakFlatTest.scala similarity index 97% rename from kyo-kernel/shared/src/test/scala/kyo/kernel/WeakFlatTest.scala rename to kyo-kernel/shared/src/test/scala/kyo/kernel/internal/WeakFlatTest.scala index 27516950d..a4714d094 100644 --- a/kyo-kernel/shared/src/test/scala/kyo/kernel/WeakFlatTest.scala +++ b/kyo-kernel/shared/src/test/scala/kyo/kernel/internal/WeakFlatTest.scala @@ -1,7 +1,6 @@ -package kyo.kernel +package kyo.kernel.internal -import kyo.Test -import kyo.discard +import kyo.* class WeakFlatTest extends Test: diff --git a/kyo-prelude/jvm/src/test/scala/kyo/ParseTest.scala b/kyo-prelude/jvm/src/test/scala/kyo/ParseTest.scala index 0de4b8b6c..31523a01d 100644 --- a/kyo-prelude/jvm/src/test/scala/kyo/ParseTest.scala +++ b/kyo-prelude/jvm/src/test/scala/kyo/ParseTest.scala @@ -1,7 +1,5 @@ package kyo -import kyo.debug.Debug - class ParseTest extends Test: "combinators" - { diff --git a/kyo-prelude/shared/src/main/scala/kyo/Abort.scala b/kyo-prelude/shared/src/main/scala/kyo/Abort.scala index ffa19934e..bf65eb214 100644 --- a/kyo-prelude/shared/src/main/scala/kyo/Abort.scala +++ b/kyo-prelude/shared/src/main/scala/kyo/Abort.scala @@ -4,7 +4,6 @@ import kernel.ArrowEffect import kyo.Result.* import kyo.Tag import kyo.kernel.Effect -import kyo.kernel.Reducible import scala.annotation.targetName /** The Abort effect allows for short-circuiting computations with failure values. This effect is used for handling errors and early diff --git a/kyo-prelude/shared/src/main/scala/kyo/Isolate.scala b/kyo-prelude/shared/src/main/scala/kyo/Isolate.scala index 947f1f671..05c31ddee 100644 --- a/kyo-prelude/shared/src/main/scala/kyo/Isolate.scala +++ b/kyo-prelude/shared/src/main/scala/kyo/Isolate.scala @@ -1,13 +1,6 @@ package kyo -import internal.* -import kyo.Flat -import kyo.Frame -import kyo.Kyo -import kyo.Var.isolate -import kyo.kernel.ContextEffect -import kyo.kernel.Safepoint.Interceptor -import scala.quoted.* +import kyo.* /** Provides fine-grained control over state isolation and propagation within computations. * diff --git a/kyo-prelude/shared/src/main/scala/kyo/Layer.scala b/kyo-prelude/shared/src/main/scala/kyo/Layer.scala index 263daa9cb..16ea92b2a 100644 --- a/kyo-prelude/shared/src/main/scala/kyo/Layer.scala +++ b/kyo-prelude/shared/src/main/scala/kyo/Layer.scala @@ -2,7 +2,6 @@ package kyo import Layer.internal.* import kyo.Tag -import kyo.kernel.Reducible /** Represents a composable layer of functionality in an application. * diff --git a/kyo-kernel/shared/src/main/scala/kyo/kernel/Reducible.scala b/kyo-prelude/shared/src/main/scala/kyo/Reducible.scala similarity index 96% rename from kyo-kernel/shared/src/main/scala/kyo/kernel/Reducible.scala rename to kyo-prelude/shared/src/main/scala/kyo/Reducible.scala index 62a7753ee..075e3d6cc 100644 --- a/kyo-kernel/shared/src/main/scala/kyo/kernel/Reducible.scala +++ b/kyo-prelude/shared/src/main/scala/kyo/Reducible.scala @@ -1,4 +1,4 @@ -package kyo.kernel +package kyo /** Represents Kyo's mechanism for safely eliding effects in specific situations. * @@ -25,7 +25,7 @@ object Reducible extends LowPriorityReducibles: /** Marker trait indicating an effect can be safely eliminated. */ trait Eliminable[S] - private[kernel] val cached = + private[kyo] val cached = new Reducible[Any]: type SReduced = Any def apply[A, S1](value: A < (S1 & Any)) = value.asInstanceOf[A < (S1 & SReduced)] diff --git a/kyo-prelude/shared/src/main/scala/kyo/debug/Debug.scala b/kyo-prelude/shared/src/main/scala/kyo/debug/Debug.scala index 574e0198a..1f851a07a 100644 --- a/kyo-prelude/shared/src/main/scala/kyo/debug/Debug.scala +++ b/kyo-prelude/shared/src/main/scala/kyo/debug/Debug.scala @@ -3,7 +3,7 @@ package kyo.debug import kyo.* import kyo.Ansi.* import kyo.kernel.Effect -import kyo.kernel.Safepoint +import kyo.kernel.internal.Safepoint import scala.collection.mutable.LinkedHashMap import scala.language.implicitConversions import scala.quoted.* diff --git a/kyo-prelude/shared/src/test/scala/kyo/PollTest.scala b/kyo-prelude/shared/src/test/scala/kyo/PollTest.scala index b601c0aec..7bc560e10 100644 --- a/kyo-prelude/shared/src/test/scala/kyo/PollTest.scala +++ b/kyo-prelude/shared/src/test/scala/kyo/PollTest.scala @@ -1,11 +1,6 @@ package kyo import kyo.* -import kyo.kernel.Platform -import org.scalatest.NonImplicitAssertions -import org.scalatest.freespec.AsyncFreeSpec -import scala.concurrent.ExecutionContext -import scala.concurrent.Future class PollTest extends Test: diff --git a/kyo-prelude/shared/src/test/scala/kyo/StreamTest.scala b/kyo-prelude/shared/src/test/scala/kyo/StreamTest.scala index 95fb33c0b..e826ba87e 100644 --- a/kyo-prelude/shared/src/test/scala/kyo/StreamTest.scala +++ b/kyo-prelude/shared/src/test/scala/kyo/StreamTest.scala @@ -1,7 +1,6 @@ package kyo import kyo.Ack.* -import kyo.kernel.Reducible class StreamTest extends Test: diff --git a/kyo-reactive-streams/shared/src/main/scala/kyo/interop/flow/StreamSubscription.scala b/kyo-reactive-streams/shared/src/main/scala/kyo/interop/flow/StreamSubscription.scala index 74e8da9bd..b9591e05c 100644 --- a/kyo-reactive-streams/shared/src/main/scala/kyo/interop/flow/StreamSubscription.scala +++ b/kyo-reactive-streams/shared/src/main/scala/kyo/interop/flow/StreamSubscription.scala @@ -3,10 +3,8 @@ package kyo.interop.flow import StreamSubscription.* import java.util.concurrent.Flow.* import kyo.* -import kyo.interop.flow.* import kyo.kernel.ArrowEffect import kyo.kernel.Boundary -import kyo.kernel.Safepoint import kyo.scheduler.IOPromise import kyo.scheduler.IOTask diff --git a/kyo-reactive-streams/shared/src/main/scala/kyo/interop/flow/package.scala b/kyo-reactive-streams/shared/src/main/scala/kyo/interop/flow/package.scala index d8512e3fb..66a0e4489 100644 --- a/kyo-reactive-streams/shared/src/main/scala/kyo/interop/flow/package.scala +++ b/kyo-reactive-streams/shared/src/main/scala/kyo/interop/flow/package.scala @@ -2,10 +2,7 @@ package kyo.interop import java.util.concurrent.Flow.* import kyo.* -import kyo.interop.flow.* import kyo.interop.flow.StreamSubscriber.EmitStrategy -import kyo.kernel.Boundary -import org.reactivestreams.FlowAdapters import scala.annotation.nowarn package object flow: diff --git a/kyo-reactive-streams/shared/src/main/scala/kyo/interop/reactive-streams/package.scala b/kyo-reactive-streams/shared/src/main/scala/kyo/interop/reactive-streams/package.scala index 603a4ea84..919c2dbb8 100644 --- a/kyo-reactive-streams/shared/src/main/scala/kyo/interop/reactive-streams/package.scala +++ b/kyo-reactive-streams/shared/src/main/scala/kyo/interop/reactive-streams/package.scala @@ -1,9 +1,7 @@ package kyo.interop import kyo.* -import kyo.interop.flow import kyo.interop.flow.StreamSubscriber.EmitStrategy -import kyo.kernel.Boundary import org.reactivestreams.* import org.reactivestreams.FlowAdapters import scala.annotation.nowarn diff --git a/kyo-reactive-streams/shared/src/main/scala/kyo/package.scala b/kyo-reactive-streams/shared/src/main/scala/kyo/package.scala index 6653b2031..73bd78491 100644 --- a/kyo-reactive-streams/shared/src/main/scala/kyo/package.scala +++ b/kyo-reactive-streams/shared/src/main/scala/kyo/package.scala @@ -3,7 +3,6 @@ package kyo import java.util.concurrent.Flow.* import kyo.* import kyo.interop.flow.* -import kyo.interop.flow.StreamSubscriber.EmitStrategy object StreamReactiveStreamsExtensions: extension [T, Ctx](stream: Stream[T, Ctx]) diff --git a/kyo-reactive-streams/shared/src/test/scala/kyo/interop/flow/CancellationTest.scala b/kyo-reactive-streams/shared/src/test/scala/kyo/interop/flow/CancellationTest.scala index c85f510a1..8490f5a86 100644 --- a/kyo-reactive-streams/shared/src/test/scala/kyo/interop/flow/CancellationTest.scala +++ b/kyo-reactive-streams/shared/src/test/scala/kyo/interop/flow/CancellationTest.scala @@ -2,7 +2,6 @@ package kyo.interop.flow import java.util.concurrent.Flow.* import kyo.* -import kyo.interop.flow.StreamSubscription final class CancellationTest extends Test: final class Sub[A](b: AtomicBoolean) extends Subscriber[A]: diff --git a/kyo-reactive-streams/shared/src/test/scala/kyo/interop/flow/PublisherToSubscriberTest.scala b/kyo-reactive-streams/shared/src/test/scala/kyo/interop/flow/PublisherToSubscriberTest.scala index 5af9663d2..c4d24dc53 100644 --- a/kyo-reactive-streams/shared/src/test/scala/kyo/interop/flow/PublisherToSubscriberTest.scala +++ b/kyo-reactive-streams/shared/src/test/scala/kyo/interop/flow/PublisherToSubscriberTest.scala @@ -2,10 +2,8 @@ package kyo.interop.flow import kyo.* import kyo.Duration -import kyo.debug.Debug.values import kyo.interop.flow.StreamSubscriber.EmitStrategy import kyo.kernel.ArrowEffect -import scala.annotation.tailrec abstract private class PublisherToSubscriberTest extends Test: import PublisherToSubscriberTest.* diff --git a/kyo-reactive-streams/shared/src/test/scala/kyo/interop/flow/SreamSubscriberTest.scala b/kyo-reactive-streams/shared/src/test/scala/kyo/interop/flow/SreamSubscriberTest.scala index ce565b0bf..564569967 100644 --- a/kyo-reactive-streams/shared/src/test/scala/kyo/interop/flow/SreamSubscriberTest.scala +++ b/kyo-reactive-streams/shared/src/test/scala/kyo/interop/flow/SreamSubscriberTest.scala @@ -4,7 +4,6 @@ import StreamSubscriber.EmitStrategy import java.util.concurrent.CompletableFuture import java.util.concurrent.Flow.* import kyo.* -import kyo.Maybe.* final class JavaSubscription(subscriber: Subscriber[? >: Int], batchSize: Int, counter: java.util.concurrent.atomic.AtomicInteger) extends Subscription: diff --git a/kyo-reactive-streams/shared/src/test/scala/kyo/interop/reactive-streams/StreamSubscriberTest.scala b/kyo-reactive-streams/shared/src/test/scala/kyo/interop/reactive-streams/StreamSubscriberTest.scala index 12e9db75a..5f9eb8a0b 100644 --- a/kyo-reactive-streams/shared/src/test/scala/kyo/interop/reactive-streams/StreamSubscriberTest.scala +++ b/kyo-reactive-streams/shared/src/test/scala/kyo/interop/reactive-streams/StreamSubscriberTest.scala @@ -1,13 +1,10 @@ package kyo.interop.reactivestreams -import java.lang.Thread import java.util.concurrent.atomic.AtomicInteger import kyo.* -import kyo.Result.* import kyo.interop.flow.StreamSubscriber import kyo.interop.flow.StreamSubscriber.* import org.reactivestreams.* -import org.reactivestreams.FlowAdapters import org.reactivestreams.tck.SubscriberBlackboxVerification import org.reactivestreams.tck.SubscriberWhiteboxVerification import org.reactivestreams.tck.SubscriberWhiteboxVerification.SubscriberPuppet diff --git a/kyo-scheduler-cats/jvm/src/main/scala/kyo/KyoSchedulerIOApp.scala b/kyo-scheduler-cats/jvm/src/main/scala/kyo/KyoSchedulerIOApp.scala index 9f2af0491..3e41affc4 100644 --- a/kyo-scheduler-cats/jvm/src/main/scala/kyo/KyoSchedulerIOApp.scala +++ b/kyo-scheduler-cats/jvm/src/main/scala/kyo/KyoSchedulerIOApp.scala @@ -2,7 +2,6 @@ package kyo import cats.effect.IOApp import cats.effect.unsafe.IORuntime -import cats.effect.unsafe.IORuntime.global trait KyoSchedulerIOApp extends IOApp { override def runtime = KyoSchedulerIORuntime.global diff --git a/kyo-scheduler-cats/jvm/src/main/scala/kyo/KyoSchedulerIORuntime.scala b/kyo-scheduler-cats/jvm/src/main/scala/kyo/KyoSchedulerIORuntime.scala index f72d41a24..0daf86986 100644 --- a/kyo-scheduler-cats/jvm/src/main/scala/kyo/KyoSchedulerIORuntime.scala +++ b/kyo-scheduler-cats/jvm/src/main/scala/kyo/KyoSchedulerIORuntime.scala @@ -1,7 +1,6 @@ package kyo import cats.effect.unsafe.IORuntime -import cats.effect.unsafe.IORuntime.global object KyoSchedulerIORuntime { implicit lazy val global: IORuntime = { diff --git a/kyo-scheduler-cats/jvm/src/test/scala/kyo/KyoSchedulerIOAppTest.scala b/kyo-scheduler-cats/jvm/src/test/scala/kyo/KyoSchedulerIOAppTest.scala index 39f8e3cb6..0449b9079 100644 --- a/kyo-scheduler-cats/jvm/src/test/scala/kyo/KyoSchedulerIOAppTest.scala +++ b/kyo-scheduler-cats/jvm/src/test/scala/kyo/KyoSchedulerIOAppTest.scala @@ -2,7 +2,6 @@ package kyo import cats.effect.ExitCode import cats.effect.IO -import cats.effect.IOApp object KyoSchedulerIOAppTest extends KyoSchedulerIOApp { diff --git a/kyo-scheduler/jvm-native/src/main/scala/kyo/scheduler/Worker.scala b/kyo-scheduler/jvm-native/src/main/scala/kyo/scheduler/Worker.scala index 4daa9ea38..af2eece20 100644 --- a/kyo-scheduler/jvm-native/src/main/scala/kyo/scheduler/Worker.scala +++ b/kyo-scheduler/jvm-native/src/main/scala/kyo/scheduler/Worker.scala @@ -1,8 +1,6 @@ package kyo.scheduler import Worker.State -import java.lang.invoke.MethodHandles -import java.lang.invoke.VarHandle import java.util.concurrent.Executor import java.util.concurrent.atomic.AtomicReference import java.util.concurrent.atomic.LongAdder diff --git a/kyo-scheduler/native/src/main/scala/kyo/scheduler/top/Reporter.scala b/kyo-scheduler/native/src/main/scala/kyo/scheduler/top/Reporter.scala index c95918d3e..fdd0ce8f0 100644 --- a/kyo-scheduler/native/src/main/scala/kyo/scheduler/top/Reporter.scala +++ b/kyo-scheduler/native/src/main/scala/kyo/scheduler/top/Reporter.scala @@ -1,11 +1,6 @@ package kyo.scheduler.top -import java.lang.management.ManagementFactory -import javax.management.MBeanServer -import javax.management.ObjectName -import javax.management.StandardMBean import kyo.scheduler.InternalTimer -import scala.concurrent.duration.* class Reporter( status: () => Status, diff --git a/kyo-scheduler/native/src/main/scala/kyo/scheduler/util/LoomSupport.scala b/kyo-scheduler/native/src/main/scala/kyo/scheduler/util/LoomSupport.scala index ec575e8f7..b3ab537b1 100644 --- a/kyo-scheduler/native/src/main/scala/kyo/scheduler/util/LoomSupport.scala +++ b/kyo-scheduler/native/src/main/scala/kyo/scheduler/util/LoomSupport.scala @@ -1,10 +1,6 @@ package kyo.scheduler.util import java.util.concurrent.Executor -import java.util.concurrent.Executors -import java.util.concurrent.ThreadFactory -import java.util.logging.Logger -import scala.util.control.NonFatal object LoomSupport { def tryVirtualize(enabled: Boolean, exec: Executor): Executor = exec diff --git a/kyo-stm/shared/src/main/scala/kyo/STM.scala b/kyo-stm/shared/src/main/scala/kyo/STM.scala index 9843279c3..d2a0f477b 100644 --- a/kyo-stm/shared/src/main/scala/kyo/STM.scala +++ b/kyo-stm/shared/src/main/scala/kyo/STM.scala @@ -1,9 +1,7 @@ package kyo -import java.util.Arrays import kyo.Result.Fail import scala.annotation.tailrec -import scala.util.control.NoStackTrace /** A FailedTransaction exception that is thrown when a transaction fails to commit. Contains the frame where the failure occurred. */ diff --git a/kyo-stm/shared/src/main/scala/kyo/TRefLog.scala b/kyo-stm/shared/src/main/scala/kyo/TRefLog.scala index daa94fb15..76d15dd41 100644 --- a/kyo-stm/shared/src/main/scala/kyo/TRefLog.scala +++ b/kyo-stm/shared/src/main/scala/kyo/TRefLog.scala @@ -1,7 +1,6 @@ package kyo import scala.collection.immutable.Map -import scala.collection.mutable.TreeMap /** A log of transactional operations performed on TRefs within an STM transaction. * diff --git a/kyo-stm/shared/src/test/scala/kyo/TMapTest.scala b/kyo-stm/shared/src/test/scala/kyo/TMapTest.scala index bac180f31..ca1d76684 100644 --- a/kyo-stm/shared/src/test/scala/kyo/TMapTest.scala +++ b/kyo-stm/shared/src/test/scala/kyo/TMapTest.scala @@ -1,7 +1,5 @@ package kyo -import kyo.debug.Debug - class TMapTest extends Test: "Basic operations" - { diff --git a/kyo-stm/shared/src/test/scala/kyo/TRefTest.scala b/kyo-stm/shared/src/test/scala/kyo/TRefTest.scala index 8a9261e58..d1ee561d7 100644 --- a/kyo-stm/shared/src/test/scala/kyo/TRefTest.scala +++ b/kyo-stm/shared/src/test/scala/kyo/TRefTest.scala @@ -1,7 +1,5 @@ package kyo -import kyo.debug.Debug - class TRefTest extends Test: "init and get" in run { diff --git a/kyo-zio/shared/src/main/scala/kyo/ZIOs.scala b/kyo-zio/shared/src/main/scala/kyo/ZIOs.scala index 138f45798..b9a3d2038 100644 --- a/kyo-zio/shared/src/main/scala/kyo/ZIOs.scala +++ b/kyo-zio/shared/src/main/scala/kyo/ZIOs.scala @@ -1,7 +1,6 @@ package kyo import kyo.kernel.* -import scala.util.control.NonFatal import zio.Exit import zio.FiberId import zio.Runtime