Skip to content

Instantly share code, notes, and snippets.

View ChrisCoffey's full-sized avatar

Chris Coffey ChrisCoffey

  • CollegeVine
  • Cambridge
View GitHub Profile
@ChrisCoffey
ChrisCoffey / LambdaCalculus.hs
Last active November 2, 2018 17:08
Lambda calculus for Demo on TryPurescript
module Demo where
import Prelude hiding (succ, pred)
class LambdaCalc repr where
lam :: (repr a -> repr b) -> repr (a -> b)
app :: repr (a -> b) -> repr a -> repr b
fix :: (repr a -> repr a) -> repr a

Keybase proof

I hereby claim:

  • I am chriscoffey on github.
  • I am chriscoffey (https://keybase.io/chriscoffey) on keybase.
  • I have a public key ASDPQOoTwuQAk-_1qGrtFOoGRRKOSwkAYXHi-Xy1D---ugo

To claim this, I am signing this object:

@ChrisCoffey
ChrisCoffey / fs2 Repl
Last active April 10, 2016 02:15
Inspired by Mile Sabin's shapeless Ammonite repl
#!/bin/bash
test -e ~/.coursier/cr || (mkdir -p ~/.coursier && wget -q -O ~/.coursier/cr https://git.io/vgvpD && chmod +x ~/.coursier/cr)
CLASSPATH="$(~/.coursier/cr fetch -q -p -r https://oss.sonatype.org/content/repositories/snapshots \
\
co.fs2:fs2-core_2.11:0.9.0-SNAPSHOT\
co.fs2:fs2-io_2.11:0.9.0-SNAPSHOT\
com.lihaoyi:ammonite-repl_2.11.7:0.5.7 \
\
)" java ammonite.repl.Main --predef 'import fs2._'
@ChrisCoffey
ChrisCoffey / log
Created March 29, 2016 03:07
ensime server 2.10.6 it:compile
$ sbt it:compile
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] Loading global plugins from /Users/ccoffey/.sbt/0.13/plugins
[info] Loading project definition from /Users/ccoffey/workspace/open_source/ensime-server/project
[info] Compiling 1 Scala source to /Users/ccoffey/workspace/open_source/ensime-server/project/target/scala-2.10/sbt-0.13/classes...
[info] Set current project to ensime (in build file:/Users/ccoffey/workspace/open_source/ensime-server/)
[info] Updating {file:/Users/ccoffey/workspace/open_source/ensime-server/}testingDebug...
[info] Updating {file:/Users/ccoffey/workspace/open_source/ensime-server/}testingTiming...
[info] Updating {file:/Users/ccoffey/workspace/open_source/ensime-server/}testingSimple...
[info] Updating {file:/Users/ccoffey/workspace/open_source/ensime-server/}testingEmpty...
@ChrisCoffey
ChrisCoffey / primes.scala
Last active August 29, 2015 14:14
A Functional Prime Number Generator In Scala
def primes: Stream[Long] = 2 #:: prime3
// performance: avoid redundant divide by two, so this starts at 3
private val prime3: Stream[Long] = {
def next(i: Long): Stream[Long] =
if (prime(i))
i #:: next(i + 2)
else
next(i + 2) // tail
3 #:: next(5)