Skip to content

Instantly share code, notes, and snippets.

View dyokomizo's full-sized avatar

Daniel Yokomizo dyokomizo

View GitHub Profile
# Bottom-up Type Annotation with the Cofree Comonad
How do we add extra information to a tree? This has been called [The
AST Typing
Problem](http://blog.ezyang.com/2013/05/the-ast-typing-problem/).
After being hit with this problem in Roy's new type-inference engine,
I tried figuring out how to represent the algorithm. I eventually
realised that it looked like a comonadic operation. Turns out it's
been done before but I couldn't find any complete example.
@dyokomizo
dyokomizo / Coinduction.hs
Created October 13, 2012 23:07 — forked from jonsterling/Coinduction.hs
Idea for codata syntax in Haskell
-- Inspired by http://www2.tcs.ifi.lmu.de/~abel/popl13.pdf
[codata|
codata Stream a where
head :: Stream a -> a
tail :: Stream a -> Stream a
|]
fib :: Stream Nat
[copattern|
@dyokomizo
dyokomizo / TypeClass.hs
Created October 11, 2012 12:15 — forked from tonymorris/TypeClass.hs
Type-class hierarchy
{-# LANGUAGE NoImplicitPrelude, MultiParamTypeClasses, Rank2Types, TypeOperators #-}
newtype Id a =
Id a
data a :\/ b =
Left a
| Right b
data a :/\ b =
@dyokomizo
dyokomizo / FakeWebFramework.hs
Created October 2, 2012 11:00 — forked from liamoc/FakeWebFramework.hs
Fake Haskell routing DSL
{-# LANGUAGE GADTs, KindSignatures #-}
module FakeWebFramework (add , notActuallyAWebFramework, get, Handler', link) where
import UrlPath
import Control.Monad.Writer
import Data.Maybe
maybeRead :: (Read a) => String -> Maybe a
maybeRead s = case reads s of
[(x, "")] -> Just x
@dyokomizo
dyokomizo / latency.txt
Created July 16, 2012 18:59 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@dyokomizo
dyokomizo / GITHUB-COMPARE-LINKS.md
Created June 21, 2012 04:16 — forked from mbbx6spp/GITHUB-COMPARE-LINKS.md
This Gist is worth a million beers. So buy me one (or send me a really cool t-shirt, make sure it is REALLY cool though)! :)
@dyokomizo
dyokomizo / gist:2204549
Created March 26, 2012 11:39 — forked from copumpkin/Routing.agda
Routing
module Routing where
open import Function hiding (type-signature)
open import Data.Bool hiding (_≟_)
open import Data.Maybe
open import Data.Char hiding (_≟_)
open import Data.String as String
open import Data.List as List hiding ([_])
open import Data.Product hiding (curry; uncurry)
@dyokomizo
dyokomizo / README.md
Created December 6, 2011 08:46 — forked from mbbx6spp/README.md
Idea for getting GitHub URLs for various needs

GitHub (Bash) Shell URLs

Local Shell setup

This is an environment file to source upon shell startup (via .bashrc/.bash_profile or your shell's corresponding file). If your shell isn't Bash you will likely need to port the functions to your shell's syntax.

Setup your local clone of a GitHub repo

When inside your local Git clone of a Github repo you need to do the following (only once per repo):

@dyokomizo
dyokomizo / README.md
Created December 6, 2011 08:45 — forked from mbbx6spp/README.md
Best UNIX shell-based tools I can't live without with example usages

Best UNIX Shell tools

These are a list of usages of shell commands I can't live without on UNIX-based systems.

Install

Mac OS X

Using Homebrew (yes, I am opinionated) you can install the following tools with the following packages: