This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
>>time ./hs 15 ~/tests/ :) | |
stretch tree of depth 16 check: -1 | |
65536 trees of depth 4 check: -65536 | |
16384 trees of depth 6 check: -16384 | |
4096 trees of depth 8 check: -4096 | |
1024 trees of depth 10 check: -1024 | |
256 trees of depth 12 check: -256 | |
64 trees of depth 14 check: -64 | |
long lived tree of depth 15 check: -1 | |
./hs 15 1.08s user 0.72s system 99% cpu 1.803 total |
class Outer { | |
class Inner | |
type Type | |
} | |
trait Trait | |
object Object extends Outer { | |
val inner = new Inner | |
} | |
class OuterP[A] { | |
class InnerP[B] |
;;; Clojure port of http://dysphoria.net/code/hindley-milner/HindleyMilner.scala | |
(ns hindley-milner | |
(:require [clojure.string :as str])) | |
(declare occurs-in? occurs-in-type?) | |
(defn map-state | |
"Evaluate a list of state monad values in sequence, producing | |
a list of the results of each evaluation." |
object RefactorPuzzle { | |
case class IntRdr[+A](read: Int => A) { | |
def map[B](f: A => B): IntRdr[B] = | |
IntRdr(f compose read) | |
def flatMap[B](f: A => IntRdr[B]): IntRdr[B] = | |
IntRdr(n => f(read(n)).read(n)) | |
} | |
object IntRdr { |
-- http://benedictgaster.org/wp-content/uploads/2012/08/haskwork97.pdf | |
-- Polymorphic Extensible Records for Haskell (page 3) | |
type Monoid v r = Rec { plus :: v -> v -> v , id :: v | r } | |
type Group v r = Monoid v { inv :: v -> v | r } | |
type Ring v r = Group v { mult :: v -> v -> v , one :: v | r } | |
iMonoid :: Monoid Int {} |
Simon Peyton-Jones | |
Phillip Wadler | |
Paul Chiusano | |
Tony Morris | |
Mark Hibberd | |
Edwin Brady | |
John Carmack | |
Conor McBride | |
Evan Czaplicki | |
Brian McKenna |
module hellofrege.JavaList where | |
data LinkedList a = native java.util.LinkedList where | |
native add :: Mutable s (LinkedList a) -> a -> ST s Bool | |
native get :: Mutable s (LinkedList a) -> Int -> ST s (Maybe a) | |
native new :: () -> STMutable s (LinkedList a) | |
fromFregeList :: [a] -> STMutable s (LinkedList a) | |
fromFregeList xs = LinkedList.new () >>= loop xs where | |
loop (x:xs) jlist = LinkedList.add jlist x >> loop xs jlist |
import qualified Data.Searchable as S -- from infinite-search package | |
import Control.Applicative (liftA2) | |
import Data.Function (fix) | |
-- We will see that a function which takes codata as an argument is | |
-- not necessarily codata itself. Here we see an isomorphism between | |
-- total functions of type (Stream Bool -> a) and finite trees of the | |
-- shape (SBFunc a) (below), whenever a has decidable equality. | |
-- We will be using infinite lists as streams, pretending |
package Vect | |
import scala.language.higherKinds | |
sealed trait Nat | |
sealed trait Z extends Nat | |
sealed trait S[N <: Nat] extends Nat | |
trait Exists[A, +B[_ <: A]] { | |
type fst <: A |