Skip to content

Instantly share code, notes, and snippets.

import scala.concurrent.duration._
import $ivy.`com.spinoco:fs2-kafka_2.12:0.4.0-M2`
import spinoco.protocol.kafka.{Broker, PartitionId, ProtocolVersion, TopicName}
import spinoco.fs2.kafka
import spinoco.fs2.kafka._
import cats.effect.IO
object Fs2KafkaClientResources {
@dsebban
dsebban / simple_transducer.sc
Last active August 20, 2018 09:17
transducer
object Transducer {
sealed trait Process[I, O]
case class Halt[I,O]() extends Process[I,O]
case class Emit[I,O](h: O, tail: Process[I, O]) extends Process[I,O]
case class Await[I,O](recv: Option[I] => Process[I,O]) extends Process[I,O]
}
import Transducer._
object ProcessOps {
@dsebban
dsebban / ammonite-script-fs2.sc
Created August 6, 2018 09:15
Import from bintray in an ammonite scala-script
import coursier.core.Authentication, coursier.MavenRepository
interp.repositories() ++= Seq(MavenRepository(
"http://dl.bintray.com/ovotech/maven"
))
@
import $ivy.`com.ovoenergy::fs2-kafka-client:0.1.13`
@dsebban
dsebban / ammonite-console-resolver.scala
Last active August 6, 2018 09:14
Load fs2-kafka-client in ammonite shell using bintray resolver
amm
Loading...
Welcome to the Ammonite Repl 1.0.3-20-75e58ac
(Scala 2.12.4 Java 1.8.0_92)
If you like Ammonite, please support our development at www.patreon.com/lihaoyi
@ import coursier.core.Authentication, coursier.MavenRepository
import coursier.core.Authentication, coursier.MavenRepository
@ interp.repositories() ++= Seq(MavenRepository(
"http://dl.bintray.com/ovotech/maven"
input output # implementations
a: A A 1
a: A, b: A A 2
as: List[A] List[A] little bit more
a: A Int a lot more!
T => List[T]
trait WithMap[F[_]] {
}
List("a") -> List[String] -> List -> ???
// value proper type first order type ???
scala> val l: List = List(1,2,3)
<console>:12: error: type List takes type parameters
val l: List = List(1,2,3)
^
scala> val name = "daniel"
name: String = daniel
scala> val one = 1
one: Int = 1
scala> val oneAndTwoAsTuple = (1,2)
oneAndTwoAsTuple: (Int, Int) = (1,2)
scala> val oneAndTwoInAList = List(1,2)