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
trait Functor[F[_]] { | |
def (fa: F[A]) map[A, B](f: A => B): F[B] | |
} | |
case class IO[+A](run: () => A) | |
object IO { | |
def pure[A](a: => A): IO[A] = IO(() => a) | |
implied IOFunctor for Functor[IO] { |
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.reflect._ | |
import scala.compiletime._ | |
import scala.compiletime.Shape._ | |
enum Maybe[+A] derives ToJson { | |
case Just(value: A) | |
case Nope | |
} |
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
name := "zkafka" | |
version := "0.1" | |
scalaVersion := "2.13.1" | |
libraryDependencies ++= Seq( | |
"dev.zio" %% "zio" % "1.0.0-RC17", | |
"dev.zio" %% "zio-streams" % "1.0.0-RC17", | |
"com.propensive" %% "magnolia" % "0.12.6" |
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
/** | |
* Arithmetic expression representation. | |
* | |
* In this expressions you can only have a unique variable. | |
* eg. Mult(Var, Add(Const(2), Var)) represents X * (2 + X) | |
*/ | |
sealed trait Expression | |
object Expression { | |
// represent a variable | |
case object Var extends Expression |
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.lang.{Boolean => JBoolean} | |
import scala.util.{Failure, Success, Try} | |
import com.typesafe.config._ | |
import zio.config.PropertyTree.{Leaf, Record, Sequence} | |
import zio.config.{ConfigSource, PropertyTree, ReadError} | |
import zio.{IO, config} | |
/** | |
* Load a configuration from different sources based on the given | |
* configuration 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
/** | |
* Autogenerated by Avro | |
* | |
* DO NOT EDIT DIRECTLY | |
*/ | |
package test.entity; | |
@org.apache.avro.specific.AvroGenerated | |
public enum Currency implements org.apache.avro.generic.GenericEnumSymbol<Currency> { | |
EUR, USD ; | |
public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"enum\",\"name\":\"Currency\",\"namespace\":\"test.entity\",\"symbols\":[\"EUR\",\"USD\"]}"); |
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
package io.univalence.aboutfp | |
import org.apache.spark.rdd.RDD | |
import org.apache.spark.sql.SparkSession | |
object TextMain { | |
def main(args: Array[String]): Unit = { | |
val spark = SparkSession.builder() | |
.master("local[*]") | |
.appName(getClass.getSimpleName) |
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 io.univalence.data.{Stock, StockKey, StockKeyBinarySerde, StockBinarySerde} | |
import java.time.Instant | |
import java.time.temporal.ChronoUnit | |
import org.openjdk.jmh.annotations._ | |
import scala.util.Random | |
abstract class BaseKeyValueStoreBenchmark { | |
val products = List("café", "chocolat", "miel") |
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.util.{Failure, Success, Try} | |
/** | |
* Tools to manage pseudo-binary data. | |
* | |
* A pseudo-binary data, or ''pseudobin''. Is a (almost) readable binary | |
* format. It is not as optimized of pure binary format, but it is | |
* easier to analyse and more optimized than the fully readable formats | |
* like JSON, CSV, or XML. pseudobin is designed to be a predictable | |
* format. |
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 org.apache.kafka.common.serialization.Serde | |
import org.apache.kafka.streams.kstream.{Named, ValueTransformerWithKey} | |
import org.apache.kafka.streams.processor.ProcessorContext | |
import org.apache.kafka.streams.scala.StreamsBuilder | |
import org.apache.kafka.streams.scala.kstream.KStream | |
import org.apache.kafka.streams.state.{ | |
KeyValueBytesStoreSupplier, | |
KeyValueStore, | |
Stores | |
} |