Original link: http://www.concentric.net/~Ttwang/tech/inthash.htm
Taken from: http://web.archive.org/web/20071223173210/http://www.concentric.net/~Ttwang/tech/inthash.htm
Reformatted using pandoc
Thomas Wang, Jan 1997
last update Mar 2007
Original link: http://www.concentric.net/~Ttwang/tech/inthash.htm
Taken from: http://web.archive.org/web/20071223173210/http://www.concentric.net/~Ttwang/tech/inthash.htm
Reformatted using pandoc
Thomas Wang, Jan 1997
last update Mar 2007
# 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. |
-- 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| |
{-# LANGUAGE NoImplicitPrelude, MultiParamTypeClasses, Rank2Types, TypeOperators #-} | |
newtype Id a = | |
Id a | |
data a :\/ b = | |
Left a | |
| Right b | |
data a :/\ b = |
{-# 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 |
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 |
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) |
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.
When inside your local Git clone of a Github repo you need to do the following (only once per repo):