Skip to content

Instantly share code, notes, and snippets.

View d-plaindoux's full-sized avatar
🐪

Didier Plaindoux d-plaindoux

🐪
View GitHub Profile
@elizarov
elizarov / Delimited.kt
Last active October 23, 2023 20:19
Delimited Continuations shift/reset in Kotlin
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
/**
* Implementation for Delimited Continuations `shift`/`reset` primitives via Kotlin Coroutines.
* See [https://en.wikipedia.org/wiki/Delimited_continuation].
*
* The following LISP code:
*
* ```
@jdegoes
jdegoes / fpmax.scala
Created July 13, 2018 03:18
FP to the Max — Code Examples
package fpmax
import scala.util.Try
import scala.io.StdIn.readLine
object App0 {
def main: Unit = {
println("What is your name?")
val name = readLine()
@SystemFw
SystemFw / Free conversation.md
Last active October 17, 2023 09:57
Explaining some of the mechanics of interpretation of Free programs

Balaji Sivaraman @balajisivaraman_twitter

Hi all, I need some help understanding a piece of Doobie code from the examples. It is the StreamingCopy one: (https://github.com/tpolecat/doobie/blob/series/0.4.x/yax/example/src/main/scala/example/StreamingCopy.scala). I am using a modified version of the fuseMap2 example from that file. Here’s how I’ve modified it for my requirements:

  def fuseMap[F[_]: Catchable: Monad, A, B](
      source: Process[ConnectionIO, A],
      sink: Vector[A] => ConnectionIO[B],
      delete: ConnectionIO[Unit]
  )(
 sourceXA: Transactor[F],
@brendanzab
brendanzab / reactive_systems_bibliography.md
Last active October 10, 2022 06:36
A reading list that I'm collecting while building my Rust ES+CQRS framework: https://github.com/brendanzab/chronicle

Functional, Reactive, and Distributed Systems Bibliography

Books

@jbgi
jbgi / Term.java
Last active September 25, 2023 00:45
Generalized Algebraic Data Types (GADT) in Java
import static java.lang.System.*;
import java.util.function.BiFunction;
import java.util.function.Function;
// Implementation of a pseudo-GADT in Java, translating the examples from
// http://www.cs.ox.ac.uk/ralf.hinze/publications/With.pdf
// The technique presented below is, in fact, just an encoding of a normal Algebraic Data Type
// using a variation of the visitor pattern + the application of the Yoneda lemma to make it
// isomorphic to the targeted 'GADT'.
@tibr
tibr / NSFileManager+DoNotBackup.h
Created March 8, 2012 09:42
Setting the do not backup attribute in different iOS versions
@interface NSFileManager (DoNotBackup)
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL;
@end
@hisui
hisui / OperatorPrecedencePersers.scala
Last active September 6, 2020 17:41
Parser combinator for Operator-precedence
package jp.segfault.scala.util
import scala.util.parsing.combinator._
/**
* Parser combinator for Operator-precedence parser(http://en.wikipedia.org/wiki/Operator-precedence_parser).
*/
trait OperatorPrecedenceParsers extends Parsers {
trait Op[+T,U] {