I hereby claim:
- I am sergey-scherbina on github.
- I am sergiyshcherbyna (https://keybase.io/sergiyshcherbyna) on keybase.
- I have a public key ASDxX06e2c4DfESWQH_4qyYaFtdL4gChJMkDBtQjB0uy4go
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| object OpenUnion extends App { | |
| trait in[A, B] { | |
| def inj(a: A): B | |
| } | |
| object in { | |
| implicit def inSelf[A]: (A in A) = (a: A) => a | |
| implicit def inHead[A, B]: (A in (A Either B)) = (a: A) => Left(a) | |
| implicit def inRight[A, B, C](implicit r: (A in C)): (A in (B Either C)) = | |
| (a: A) => Right(r.inj(a)) |
| package json.diff; | |
| import com.fasterxml.jackson.core.JsonLocation; | |
| import com.fasterxml.jackson.core.JsonParser; | |
| import com.fasterxml.jackson.core.JsonToken; | |
| import com.fasterxml.jackson.databind.ObjectMapper; | |
| import com.google.common.collect.MapDifference; | |
| import com.google.common.collect.Maps; | |
| import java.io.File; |
| import io.vavr.Tuple; | |
| import io.vavr.collection.Iterator; | |
| import io.vavr.control.Option; | |
| import io.vavr.control.Try; | |
| import java.util.List; | |
| import java.util.function.*; | |
| public interface Mapper<S, T> extends BiFunction<T, S, Boolean> { |
| // Faster coroutine pipelines | |
| // https://dl.acm.org/citation.cfm?doid=3136534.3110249 | |
| // https://github.com/iokasimov/pipeline/blob/master/Control/Pipeline.hs | |
| object Monads { | |
| trait Monad[M[_]] { | |
| def pure[A](a: A): M[A] | |
| def >>=[A, B](m: M[A])(f: A => M[B]): M[B] |
| /* | |
| https://github.com/rizo/streams/blob/master/src/coroutine.ml | |
| https://pusher.com/sessions/meetup/the-realtime-guild/realtime-stream-processing-with-coroutines | |
| */ | |
| object Pipes { | |
| sealed trait Pipe[I, O, R] { | |
| final def flatMap[T](f: R => Pipe[I, O, T]): Pipe[I, O, T] = this match { |
| import Cont._ | |
| object ContTest extends App { | |
| def fib() = loop(for { | |
| (x, y) <- take[(BigInt, BigInt), Stream[BigInt]] | |
| _ <- put(x) | |
| } yield (y, x + y))(1, 1) | |
| println(fib().take(100).toList) |
| import org.parboiled2._ | |
| /* | |
| http://okmij.org/ftp/tagless-final/course/lecture.pdf | |
| */ | |
| object Tagless extends scala.App { | |
| type Id[A] = A | |
| trait ~>[F[_], G[_]] { |
| package sandbox | |
| import scala.annotation.tailrec | |
| import scala.util.continuations.{cps, _} | |
| /* | |
| Introduction to Programming with Shift and Reset | |
| http://pllab.is.ocha.ac.jp/~asai/cw2011tutorial/main-e.pdf | |
| */ |
| import scala.annotation.tailrec | |
| import Thunk._ | |
| /* | |
| https://www.cs.utah.edu/~mflatt/past-courses/cs6520/public_html/s02/cps.pdf | |
| */ | |
| sealed trait Thunk[A, B] { | |
| @inline final def run(f: A => B): B = Thunk.run(this, f) | |
| } |