Skip to content

Commit

Permalink
[data] make Tag[Defer] compact (#849)
Browse files Browse the repository at this point in the history
  • Loading branch information
hearnadam authored Nov 20, 2024
1 parent 11f2447 commit b0e83b0
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 38 deletions.
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

0 comments on commit b0e83b0

Please sign in to comment.