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
| <DT><H3 ADD_DATE="1390495188" LAST_MODIFIED="1411568985">formats</H3> | |
| <DL><p> | |
| <DT><A HREF="http://swannodette.github.io/2014/07/23/a-closer-look-at-transit/" ADD_DATE="1406235975">A Closer Look at Transit</A> | |
| <DT><A HREF="http://ocharles.org.uk/blog/posts/2014-06-10-reversible-serialization.html" ADD_DATE="1403296256">A Category for Correct-By-Construction Serializers and Deserializers</A> | |
| <DT><A HREF="http://tools.ietf.org/html/draft-alakuijala-brotli-01" ADD_DATE="1402837786" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAl0lEQVQ4jaVSwRHEIAhcb64jUpPWRGqCmrhHlJMkPhJ2xoFZdIXVYmaGBD6ZwwDwHYm2LRSI5cIBAFUGiP6ETZBKJpVsyYkcuYjXn43Qb9a9OZX24JmA6tFIZafKeMa3JrrAW6Q9KFIp1UF+hGHUHMdyvrsPVZz3XzwglhCB/nFUwwfyDma1FYgFurcgGgTuCqvOZmjb8ANXSXxE46FkwQAAAABJRU5ErkJggg==">draft-alakuijala-brotli-01 - Brotli Compressed Data Format</A> | |
| <DT><A HREF="https://github.com/JonathanSalwan/binary-sa |
| module Fix where | |
| left :: a -> (a -> c) -> (b -> c) -> c | |
| left a l r = l a | |
| right :: b -> (a -> c) -> (b -> c) -> c | |
| right b l r = r b | |
| fix f a = f a (fix f) id |
| We have three data types: | |
| - Name and Password, both with String representations; | |
| - Account, a Name and Password pair. | |
| Given that each data type can have its invariants, we have some functions, representing morphisms from the data type to its representation (M is some Monad, like Maybe/Either/Validation, it's not important which): | |
| - stringToName :: String -> M Name | |
| - nameToString :: Name -> String |
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. |
| {-# LANGUAGE EmptyDataDecls, GADTs #-} | |
| module Glob where | |
| data L -- Witness for globs that begin/end with a literal | |
| data S -- Witness for globs that begin/end with a star | |
| data Glob a b e where -- Globs over [a] that begin with b and end with e | |
| L :: [a] -> Glob a L L -- Literal glob | |
| S :: Glob a S S -- Star glob |
| -- 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 |