When Rich Hickey announced Transducers a few days ago I got excited. They felt very similar to some CPS transformation tricks I’d begun to analyze deeply in Haskell. Thus, I tried to translate the concept into Haskell. This seems to have inspired a few others to examine this avenue.
This post is my current best understanding of Transducers via Haskell types. I want to emphasize that this isn’t intended to be a complete analysis—there’s a good chance that the type I give doesn’t well-represent transducers due to the loss of flexibility you get when directly translating to a strongly typed language.
My hope is that this analysis will provide a window to better understand transducers and a few avenues to try new constructions with them. For instance, I build a Haskell
Arrow instance for
Transducer and that suggests it might be nice to see an arrow syntax macro in Clojure.