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 DependentValue{ | |
type V | |
val value: V | |
} | |
//object DependentValue { | |
// def apply[A](a: A): DependentValue { type V = A } = new DependentValue { | |
// type V = A | |
// val value = a | |
// } |
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 shapeless._ | |
val oneHello = 1 :: "hello" :: Nil | |
val oneHello = 1 :: "hello" :: HNil | |
final case class User(name: String, age: Int) | |
val genericUser = Generic[User] | |
type GenericUserType = genericUser.Repr |
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 shapeless._ | |
import scala.{:: => :::} | |
import cats.implicits._ | |
trait CsvDecoder[A] { | |
def decode(value: List[String]): Option[A] | |
} | |
val columnSplitter = """,(?=([^\"]*\"[^\"]*\")*[^\"]*$)""".r |
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 magnolia._ | |
import scala.language.experimental.macros | |
import scala.util.Try | |
final case class User(name: String, age: Int, admin: Boolean) | |
trait CsvDecoder[A] { | |
def decode(value: List[String]): Either[Throwable, A] | |
} |
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 cats._ | |
import cats.effect.IO | |
import cats.implicits._ | |
case class MonadT[F[_], G[_], A](value: F[G[A]]) | |
object MonadT { | |
implicit def monad[F[_], G[_]](implicit MF: Monad[F], MG: Monad[G], TG: Traverse[G]): Monad[({ type T[A] = MonadT[F, G, A]})#T] = { | |
type T[A] = MonadT[F, G, A] | |
new Monad[T] { |
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 equal from 'deep-equal' | |
export function immutableUpdate( obj, change ) { | |
const keys = Object.keys( change ) | |
if ( keys.length === 0 ) { | |
return obj | |
} | |
const key = keys[ 0 ] | |
const value = change[ key ] | |
if ( keys.length === 1 ) { |
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 stephenzoio.kafka_tests.shared.eventsrc | |
import java.util.UUID | |
import cats._ | |
import cats.implicits._ | |
import cats.data.{EitherK, WriterT} | |
import cats.free.Free | |
import stephenzoio.kafka_tests.shared.free.FreeOp |
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 eventsourcing | |
import java.time.Instant | |
import cats._ | |
import cats.data.Coproduct | |
import cats.free.{Free, Inject} | |
import cats.implicits._ | |
import doobie.imports._ | |
import fs2.Stream |