This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.esotericsoftware.kryo.io.{Input, Output} | |
import com.twitter.chill.{KSerializer, Kryo} | |
import scala.runtime.LazyVals | |
import scala.runtime.LazyVals.LazyValControlState | |
class LazyValControlStateSerializer extends KSerializer[LazyValControlState] { | |
override def read(kryo: Kryo, input: Input, cls: Class[LazyValControlState]): LazyValControlState = { | |
kryo.readClassAndObject(input).asInstanceOf[LazyValControlState] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.annotation.nowarn | |
import scala.deriving.Mirror | |
trait TC[A] { | |
def show(a: A): Unit | |
} | |
@nowarn | |
inline def gen[A](using m: Mirror.SumOf[A]): TC[A] = { | |
val subTypes = compiletime.summonAll[Tuple.Map[m.MirroredElemTypes, TC]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.nio.file.Path | |
import scala.meta.* | |
object CodeGenerator { | |
import dialects.Scala213Source3 | |
private val emptyTree = "".parse[Source].get | |
def generateLenses(path: Path): String = { | |
val files = os.walk(os.Path(path)).toList.filterNot(os.isDir) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//> using dep dev.zio::zio:2.1.11 | |
//> using dep dev.zio::zio-config-magnolia:4.0.2 | |
//> using dep com.softwaremill.sttp.client3::zio:3.10.1 | |
import sttp.client3.httpclient.zio.HttpClientZioBackend | |
import zio.* | |
import zio.config.derivation.name | |
import zio.config.magnolia.deriveConfig | |
type Language = String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//> using dep com.github.ghostdogpr::caliban-tapir:2.8.0 | |
//> using dep com.softwaremill.ox::core:0.2.2 | |
//> using dep com.softwaremill.sttp.tapir::tapir-jsoniter-scala:1.10.10 | |
//> using dep com.softwaremill.sttp.tapir::tapir-netty-server-sync:1.10.10 | |
import caliban.* | |
import caliban.interop.tapir.* | |
import caliban.schema.Schema | |
import _root_.ox.* | |
import scala.concurrent.duration.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//> using dep com.github.ghostdogpr::caliban-quick:2.7.1 | |
import caliban.* | |
import caliban.CalibanError.* | |
import caliban.Value.StringValue | |
import caliban.execution.FieldInfo | |
import caliban.parsing.adt.Directive | |
import caliban.quick.* | |
import caliban.schema.Annotations.* | |
import caliban.schema.Schema |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"jmhVersion" : "1.37", | |
"benchmark" : "caliban.ComplexQueryBenchmark.runCaliban", | |
"mode" : "thrpt", | |
"threads" : 1, | |
"forks" : 1, | |
"jvm" : "/Users/pierre/Library/Java/JavaVirtualMachines/temurin-21.0.3/Contents/Home/bin/java", | |
"jvmArgs" : [ | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//> using dep com.github.ghostdogpr::caliban-quick:2.5.0 | |
// 1. Defining the schema | |
enum Origin { | |
case EARTH, MARS, BELT | |
} | |
case class Character(name: String, nicknames: List[String], origin: Origin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//> using dep com.github.ghostdogpr::caliban:2.2.0 | |
import caliban._ | |
import caliban.schema._ | |
case class Queries(books: List[Book]) derives Schema.SemiAuto | |
case class Book(id: Int, name: String) derives Schema.SemiAuto | |
val api = graphQL(RootResolver(Queries(Nil))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.deriving.Mirror | |
import scala.compiletime._ | |
trait Schema[T] | |
object Schema { | |
implicit val stringSchema: Schema[String] = new Schema[String] {} | |
implicit def listSchema[A](implicit ev: Schema[A]): Schema[List[A]] = new Schema[List[A]] {} | |
implicit def mapSchema[A, B](implicit evA: Schema[A], evB: Schema[B]): Schema[Map[A, B]] = | |
new Schema[Map[A, B]] {} |
NewerOlder