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

[data] make Tag[Defer] compact #849

Merged
merged 1 commit into from
Nov 20, 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
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package kyo
package kyo.kernel

import kyo.kernel.*
import kyo.*
import kyo.kernel.internal.Defer
import org.scalatest.NonImplicitAssertions
import org.scalatest.compatible.Assertion

class TagCompactTest extends Test:
Expand All @@ -24,5 +26,8 @@ class TagCompactTest extends Test:
"Tag[Emit[Int]]" in {
assert(Tag[Emit[Int]].raw == "!Bv;!?s;!=q;!T0;!U1;!V2;[=!Y5;!W3;!U1;!V2;]")
}
"Tag[Defer]" in {
assert(Tag[Defer].raw == "!Fz;!?s;!=q;!T0;!U1;!V2;")
}
}
end TagCompactTest
71 changes: 36 additions & 35 deletions kyo-data/shared/src/main/scala/kyo/internal/TagMacro.scala
Original file line number Diff line number Diff line change
Expand Up @@ -133,41 +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"
"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"
)

val fromCompact = toCompact.map(_.swap).toMap
Expand Down
2 changes: 1 addition & 1 deletion kyo-prelude/shared/src/main/scala/kyo/kernel/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package object kernel:
enum Mode derives CanEqual:
case Development, Staging, Production

private object internal:
private[kernel] object internal:

inline def maxStackDepth = 512
inline def maxTraceFrames = 16
Expand Down
Loading