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
-- Inspired by http://nedbatchelder.com/blog/201301/stupid_languages.html | |
-- which describes how the Javascript array.map function seems weird | |
-- and also http://blog.sigfpe.com/2008/03/comonadic-arrays.html | |
-- which describes the comonad for arrays | |
import Data.Array | |
import Data.Char | |
class Functor w => Comonad w where | |
(=>>) :: w a -> (w a -> b) -> w b |
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.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
import scalaz.zio.console._ | |
import scalaz.zio.stream._ | |
import scalaz.zio.{Chunk, ZIO} | |
object Framing { | |
def lfDelimiter = Chunk('\n') |
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} | |