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
bject Tag { | |
type Tagged[T] = { | |
type Tag = T | |
} | |
type @@[A, T] = A with Tagged[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
/** | |
* Catch exceptions to create an `Either` value. | |
* | |
* Useful when you want to deal an API that reports failure conditions using | |
* exceptions. This method allows catching exceptions and converting them to | |
* `Left` values. | |
* | |
* An advantage vs using `scala.util.Try` is that you have full control over | |
* which exceptions are caught. | |
* |
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 test | |
import java.net.InetSocketAddress | |
import akka.actor.{ActorLogging, ActorRef, Props} | |
import akka.io | |
import akka.stream.ActorMaterializer | |
import akka.stream.actor.ActorPublisher | |
import akka.stream.scaladsl.Source |
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.time.{Clock, Instant} | |
import akka.NotUsed | |
import akka.actor.ActorSystem | |
import akka.stream.{Attributes, FlowShape, Inlet, Outlet, _} | |
import akka.stream.stage.{GraphStage, GraphStageLogic, InHandler, OutHandler, _} | |
import scaladsl.{Flow, _} | |
import scala.concurrent.Await | |
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
// Scala version of code from https://en.wikipedia.org/wiki/Generalized_algebraic_data_type | |
sealed abstract class Expr[A] | |
final case class EBool(a: Boolean) extends Expr[Boolean] | |
final case class EInt(a: Int) extends Expr[Int] |
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 monix.reactive._ | |
import monix.execution._ | |
import Ack.{Stop, Continue} | |
import scala.util.control.NonFatal | |
import scala.concurrent._ | |
import scala.concurrent.duration._ | |
def feed[A](in: Iterator[A], out: Observer[A]) | |
(implicit s: Scheduler): Future[Ack] = { |
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 monix.rsocket.tcp | |
import java.nio.charset.StandardCharsets | |
import monix.eval.{Callback, Task} | |
import monix.reactive.Observable | |
import monix.nio.tcp._ | |
import monix.execution.Scheduler.Implicits.global | |
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.ByteBuffer | |
import monix.nio.text.UTF8Codec._ | |
import monix.nio.file | |
import monix.reactive._ | |
import monix.reactive.observers.Subscriber | |
import monix.execution._ | |
import monix.execution.exceptions | |
import monix.execution.atomic.Atomic | |
import monix.reactive.subjects.Subject |
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 au.com.str.stellar | |
import cats.implicits._ | |
import monix.eval.{Task, TaskApp} | |
import monix.reactive.Observable | |
import scala.concurrent.duration._ | |
object Test extends TaskApp { |
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.io.InputStream | |
import java.nio.file.{Files, Path, Paths} | |
import scalaz.zio.console.putStrLn | |
import scalaz.zio.duration._ | |
import scalaz.zio.stream.Stream | |
import scalaz.zio.stream.Stream.Fold | |
import scalaz.zio.{App, Chunk, IO, Managed} | |