ezyang’s blog

the arc of software bends towards understanding

Hack

Interrupting GHC

In my tech talk about abcBridge, one of the “unsolved” problems I had with making FFI code usable as ordinary Haskell code was interrupt handling. Here I describe an experimental solution involving a change to the GHC runtime system as suggested by Simon Marlow. The introductory section may be interesting to practitioners looking for working […]

  • August 27, 2010

System.Posix.Redirect

System.Posix.Redirect is a Haskell implementation of a well-known, clever and effective POSIX hack. It’s also completely fails software engineering standards. About a week ago, I excised this failed experiment from my work code and uploaded it to Hackage for strictly academic purposes. What does it do? When you run a command in a shell script, […]

  • July 19, 2010

Cup of FP with a Java twist

zip: List<A>, List<B> -> List<(A, B)> zip(Nil, Nil) = Nil zip(_, Nil) = Nil zip(Nil, _) = Nil zip(Cons(a, as), Cons(b, bs)) = Cons((a, b), zip(as, bs)) fst: (A, B) -> A fst((a, _)) = a last: List<A> -> A last(Cons(a, Nil)) = a last(Cons(a, as)) = last(as) foldl: (B, A -> B), B, List<A> […]

  • April 5, 2010

Scheming environments

Environments are first-class objects in MIT/GNU Scheme. This is neat, because an integral part of the lexical structure of a Scheme is also a data-structure in its own right, able to encode data and behavior. In fact, the environment data structure is precisely what Yegge calls property lists, maps that can be linked up with […]

  • February 12, 2010

Cute macro tricks in the kernel

A classic stylistic tip given to C programmers is that inline functions should be preferred over macros, when possible. This advice stems from the fact that a macro and an inline function can achieve the same effect, but the inline function also gets type checking. As it turns out, you can achieve static type checking […]

  • February 1, 2010

Hacking git-rerere

An unusual workflow for Git, one that Wizard employs extensively, is when a single developer needs to perform merges inside lots of working copies. Normally, a maintainer would pull from the branches he cared about, and offload a large amount of the work to those who were interested in contributing patches. However, Wizard is using […]

  • January 22, 2010