@technomancy @neauoire @klardotsh There's a very fun Haskell community thesis I remember reading that deals explicitly with building backtracking/elastic formatting engines for this sort of thing. I think it's referenced by one of the clojure pretty-printers but it's been a while.