Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reorganize kernel + remove unused imports #937

Merged
merged 4 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions kyo-bench/src/main/scala/kyo/bench/TRefMultiBench.scala
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 0 additions & 2 deletions kyo-bench/src/main/scala/kyo/bench/TRefSingleBench.scala
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
1 change: 0 additions & 1 deletion kyo-cats/shared/src/main/scala/kyo/Cats.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions kyo-combinators/shared/src/main/scala/kyo/Constructors.scala
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package kyo

import scala.concurrent.Future
import scala.util.Try

class AbortCombinatorTest extends Test:
Expand Down
Original file line number Diff line number Diff line change
@@ -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 =
Expand Down
1 change: 0 additions & 1 deletion kyo-core/jvm/src/test/scala/kyo/internal/SignalTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
1 change: 0 additions & 1 deletion kyo-core/native/src/main/scala/kyo/hubsStubs.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package java.util.concurrent

import java.util.function.Predicate
import kyo.discard
import scala.collection.mutable
import scala.reflect.ClassTag

Expand Down
2 changes: 0 additions & 2 deletions kyo-core/native/src/main/scala/kyo/queuesStubs.scala
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 0 additions & 1 deletion kyo-core/shared/src/main/scala/kyo/Channel.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package kyo

import org.jctools.queues.MessagePassingQueue.Consumer
import org.jctools.queues.MpmcUnboundedXaddArrayQueue
import scala.annotation.tailrec

Expand Down
3 changes: 1 addition & 2 deletions kyo-core/shared/src/main/scala/kyo/Fiber.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions kyo-core/shared/src/main/scala/kyo/IO.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
1 change: 0 additions & 1 deletion kyo-core/shared/src/main/scala/kyo/System.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
2 changes: 0 additions & 2 deletions kyo-core/shared/src/main/scala/kyo/Timeout.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package kyo

import scala.util.control.NoStackTrace

class Timeout()(using Frame) extends KyoException(t"Computation has timed out.")
3 changes: 1 addition & 2 deletions kyo-core/shared/src/main/scala/kyo/scheduler/IOPromise.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
1 change: 1 addition & 0 deletions kyo-core/shared/src/main/scala/kyo/scheduler/IOTask.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 0 additions & 4 deletions kyo-core/shared/src/test/scala/kyo/KyoAppTest.scala
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion kyo-data/shared/src/main/scala/kyo/Chunk.scala
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion kyo-data/shared/src/main/scala/kyo/Render.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package kyo

import kyo.Schedule.done
import scala.annotation.nowarn
import scala.language.implicitConversions

Expand Down
72 changes: 36 additions & 36 deletions kyo-data/shared/src/main/scala/kyo/internal/TagMacro.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion kyo-data/shared/src/test/scala/kyo/MaybeTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package kyo

import kyo.Maybe.*
import kyo.Maybe.internal.PresentAbsent
import scala.languageFeature.implicitConversions

class MaybeTest extends Test:

Expand Down
1 change: 0 additions & 1 deletion kyo-data/shared/src/test/scala/kyo/Test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package kyo.kernel
package kyo.kernel.internal

import internal.*
import kyo.Frame

private[kernel] object TracePool:
Expand Down
5 changes: 0 additions & 5 deletions kyo-kernel/jvm/src/main/scala/kyo/kernel/Platform.scala
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
5 changes: 0 additions & 5 deletions kyo-kernel/native/src/main/scala/kyo/kernel/Platform.scala
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion kyo-kernel/shared/src/main/scala/kyo/Kyo.scala
Original file line number Diff line number Diff line change
@@ -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. */
Expand Down
7 changes: 2 additions & 5 deletions kyo-kernel/shared/src/main/scala/kyo/kernel/ArrowEffect.scala
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 1 addition & 2 deletions kyo-kernel/shared/src/main/scala/kyo/kernel/Boundary.scala
Original file line number Diff line number Diff line change
@@ -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.*

Expand Down
Original file line number Diff line number Diff line change
@@ -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.
*
Expand Down
Loading
Loading