Skip to content

Instantly share code, notes, and snippets.

Channing Walton channingwalton

Block or report user

Report or block channingwalton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
channingwalton / NonEmptySet.scala
Last active Mar 24, 2018
NonEmptySet Implementation
View NonEmptySet.scala
import cats.Eq
import scala.collection.GenTraversableOnce
sealed trait NonEmptySet[T] extends (T => Boolean) {
def head: T
def set: Set[T]
def +(t: T): NonEmptySet[T]
def ++(ts: NonEmptySet[T]): NonEmptySet[T]

Keybase proof

I hereby claim:

  • I am channingwalton on github.
  • I am channingwalton ( on keybase.
  • I have a public key ASAzN6zGSraBz_wTqUhbQLqzT4wmAjuy3zGojAOeYGo2Uwo

To claim this, I am signing this object:

channingwalton / SetPerformance.scala
Created Apr 29, 2017
Benchmark for performance of .toSet
View SetPerformance.scala
package set.performance
import java.util.concurrent.TimeUnit
import scala.concurrent.duration.FiniteDuration
* On my machine the fast method takes < 2 ms, the slow one 2.2s
object SetPerformance {
channingwalton /
Last active Jul 31, 2016
Verification for keybase

Keybase proof

I hereby claim:

  • I am channingwalton on github.
  • I am channingwalton ( on keybase.
  • I have a public key ASD_xyZHdprhe-YpLLpvwqvgVW-wFGmVXHZ8fwXP_1soLwo

To claim this, I am signing this object:

channingwalton / test.html
Created Apr 29, 2016
positive numbers only
View test.html
<SCRIPT language=Javascript>
function isNumberKey(evt)
var charCode = (evt.which) ? evt.which : event.keyCode
return charCode > 47 && charCode < 58;
channingwalton / RxConcurrency.scala
Created Apr 28, 2016
Some concurrency testing for Rx
View RxConcurrency.scala
package reactive
import java.util.concurrent.TimeUnit
import rx.lang.scala.{Observable, Subject}
import scala.concurrent.duration.Duration
* The problem: can two threads banging away from two sources be merged and have predictable results?
View gist:58ed83cb76ae2b8d699d
21:15:22.745 ERROR akka://ENSIME/user/$b o.e.s.SocketHandler - Error in socket reader:
java.lang.NumberFormatException: For input string: "new Wo"
at java.lang.NumberFormatException.forInputString( ~[na:1.8.0_31]
at java.lang.Integer.parseInt( ~[na:1.8.0_31]
at java.lang.Integer.valueOf( ~[na:1.8.0_31]
at org.ensime.server.FramedStringProtocol$class.readString(FramedStringProtocol.scala:39) ~[server_2.11-0.9.10-SNAPSHOT.jar:0.9.10-SNAPSHOT]
at org.ensime.server.SwankProtocol.readString(SwankProtocol.scala:10) ~[server_2.11-0.9.10-SNAPSHOT.jar:0.9.10-SNAPSHOT]
at org.ensime.server.S≈ ~[server_2.11-0.9.10-SNAPSHOT.jar:0.9.10-SNAPSHOT]
at org.ensime.server.SocketHandler$$anon$ ~[server_2.11-0.9.10-SNAPSHOT.jar:0.9.10-SNAPSHOT]
channingwalton / Reverse.idr
Created Sep 29, 2014
Reverse an Idris Vect
View Reverse.idr
module Main
rev : Vect n a -> Vect n a
rev Nil = Nil
rev (x :: xs) = (rev xs) ++ (x :: Nil)
main : IO ()
main = putStrLn $ show $ rev [1,2,3]
fails to compile with
channingwalton / Console.scala
Last active Oct 30, 2016
Alternatives to GADTs in Scala
View Console.scala
// No case classes
object Consoles {
trait ConsoleAlg[F[_]] {
def readLine: F[Option[String]]
def printLine(line: String): F[Unit]
trait Console[+A] {
You can’t perform that action at this time.