Skip to content

Instantly share code, notes, and snippets.

Avatar

Roland Kuhn rkuhn

View GitHub Profile
View does_not_work.rs
struct X<T>(T);
impl<T> X<T> {
pub fn new(t: T) -> Self {
Self(t)
}
pub fn map<U>(&self, mut f: impl FnMut(&T) -> U + 'static) -> X<U> {
X(f(&self.0))
}
}
View test_fun.idr
module Main
%default total
data Event = Started Int | Stopped Int | Completed Int
data State = Idle | Running | Finished
data S : s -> Type
data Activity : Type -> Event -> Type -> Type where
@rkuhn
rkuhn / console.log
Created Sep 9, 2019
failing idris program
View console.log
Rolands-MBP:idris-test rkuhn$ idris test.idr -o test
idris: Can't happen pickAlt - impossible case found
CallStack (from HasCallStack):
error, called at src/IRTS/LangOpts.hs:248:25 in idris-1.3.2-9ZZwhBKx1W3Fg3FkIorcnE:IRTS.LangOpts
@rkuhn
rkuhn / keepMyKeys.js
Created May 26, 2019
GreaseMonkey script to prevent websites from messing with my keyboard shortcuts
View keepMyKeys.js
// ==UserScript==
// @name forbid rebinding my keys
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Get off my lawn!
// @author Roland Kuhn
// @include *
// @grant none
// ==/UserScript==
@rkuhn
rkuhn / Client.java
Last active Jan 27, 2017
demo of missing backpressure propagation in ReactiveSocket Java (Jan 27, 2017)
View Client.java
package com.rolandkuhn.rs;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import io.reactivesocket.ReactiveSocket;
import io.reactivesocket.client.KeepAliveProvider;
import io.reactivesocket.client.ReactiveSocketClient;
View Coroutines.scala
package akka.typed
import scala.concurrent.duration._
import org.coroutines._
object Coroutines {
/**
* This will be a collection of all the management commands that are sent
* to a Session-hosting Actor via its main channel (i.e. the ActorRef that
* is returned directly for it).
View equational-reasoning-limits.md

Some limits of equational reasoning

This is a follow-up on a discussion on gitter I had with Rob Norris. Gitter is great, but it is easier to make a coherent argument in a gist.

The monad laws allow us to assert that in the following the two results will describe computations that eventually yield the same value:

val fut1 = Future(<comp1>)
val fut2 = Future(<comp2>)
@rkuhn
rkuhn / Trial2712.scala
Last active Feb 27, 2019
Trying out workarounds for SI-2712: we are running into it when trying to generically extend the FlowOps / FlowOpsMat types in Akka Streams’ Scala DSL.
View Trial2712.scala
import scala.annotation.unchecked.uncheckedVariance
object Trial2712 {
trait NotUsed
import language.higherKinds
/*
* The following are simplified versions of FlowOps / FlowOpsMat and their
* concrete subtypes.
*/
View MergeSorted.scala
class MergeSorted[T: Ordering] extends GraphStage[FanInShape2[T, T, T]] {
private val left = Inlet[T]("left")
private val right = Inlet[T]("right")
private val out = Outlet[T]("out")
override val shape = new FanInShape2(left, right, out)
override def createLogic(attr: Attributes) = new GraphStageLogic(shape) {
import Ordering.Implicits._
setHandler(left, ignoreTerminateInput)
View GitterIntro.md

The akka/akka Gitter Channel

This channel is available for all Akka enthusiasts—newbies as well as gurus—for the exchange of knowledge and the coordination of efforts around Akka; it is a community effort and resource and not backed by Typesafe. For more structured discussions please refer to the akka-user mailing list.

Instead of a long Code of Conduct we rely upon common sense: be kind and respectful to those who are already here and to those who come after you, harassment of any kind will not be tolerated; in case of trouble contact akka.official.

Please also note that this is not an official Akka support channel, for commercial support please contact Typesafe or visit Typesafe.com.

You can’t perform that action at this time.