Skip to content

Instantly share code, notes, and snippets.

View 0xYUANTI's full-sized avatar

JJS 0xYUANTI

View GitHub Profile
adding
type intLeaf = | Leaf int;
results in
jakob@crunchy:/usr/home/jakob/git/botcloud/telegram-re$ rebuild -pkg cohttp.lwt wtf.native
+ /usr/local/bin/ocamldep.opt -modules -pp refmt -impl wtf.re | tee wtf.re.depends wtf.ml.depends
Fatal error: exception Not_found
File "wtf.re", line 1:
object icm {
// Types
type Player = Int
type Chips = Double
type Stacks = Map[Player, Chips]
type Rank = Int
type Money = Double
import fs2.interop.scalaz._
import fs2.{Scheduler, Strategy, time}
import scala.concurrent.duration._
import scalaz.concurrent.{Task => ZTask}
// porting some code from scalaz.concurrent.chan to fs2...
// we need to call a few external rest apis every N seconds and process the results.
object App {
def main(args: Array[String]): Unit = {
// this seems like a useful FS2 Stream function, is it already built in?
// Folds a function into a stream and gives you a stream of the intermediate
// accumulator values, i.e.:
// > val ones = Stream.iterate(1)(x => x)
// > ones.foldIncremental(0)(_ + _) take 3 toList
// ==> List[Int] = List(1, 2, 3)
implicit class StreamOps[F[_], O](private val self: Stream[F, O]) {
def foldIncremental[O2](z: O2)(f: (O2, O) => O2): Stream[F, O2] =
self.mapAccumulate(z) {

Keybase proof

I hereby claim:

  • I am 0xyuanti on github.
  • I am yuanti (https://keybase.io/yuanti) on keybase.
  • I have a public key ASAVjKmujfL5xp2V7HHVm9HVxufwaZkwQp7W34Mu4c6mnwo

To claim this, I am signing this object: