Skip to content

Latest commit

 

History

History
17 lines (9 loc) · 1.71 KB

README.md

File metadata and controls

17 lines (9 loc) · 1.71 KB

Clojure transducers in a typed setting, in Haskell

I was struggling to understand Rich Hickey's notion of transducers in Clojure that he announced in a blog post and posted some sample code for in response to a discussion thread. The discussion there was very confusing to me, and I decided I could not really understand what was going on until I actually reimplemented the ideas in a statically typed language.

Fortunately, on another discussion thread, he posted actually running Haskell code, which helped me tremendously, since most of the discussion I had seen so far was either very vague or very abstract.

So I refactored his code to fit just exactly what he did, not something far more general, and posted my refactored code in response. I hope this will help more people understand exactly what they do, using types.

Rank-2 types

Note that the critical component of this work involves using rank-2 types. Transducers cannot be expressed in a weaker type system that does not support higher-rank types.

I hope that the introduction of transducers will create a lot of interest among those who are not already familiar with higher-rank types.

My blog post

I wrote a blog post about this code.