
Edward Z. Yang wrote:
Excerpts from Paul Lotti's message of Thu Jun 17 15:33:30 -0400 2010:
Same feelings here. I work in a company that uses C++/Java and the best I could manage was to use Haskell for prototyping and then deliver in Java. This worked out twice so far. The downside is having to translate it later.
*Shudders at the though.* Must be a what, x10 size blow-up?
I've done that too. It works fairly well for certain kinds of programs/problems, but you have to be careful about your abstractions. For instance, Java Generics are no substitute for real parametric polymorphism. They only work for the simplest kind of container/element polymorphism, interact poorly (i.e., not at all) with subclassing, and explode with many of the higher-order tricks common in idiomatic Haskell. Any sort of higher-order programming (HOFs, point-free style, CPS, parametricity,...) rarely translates well--- especially if you want to avoid code bloat and have anything resembling idiomatic Java. Though sometimes defunctionalization[1] can help. The code blow up varies. 10x is on the good side of things and indicates a good match of abstractions. 20x or 30x is more common I think. But if you're relying on any libraries or fancy datastructures, you'll be lucky not to have to reimplement everything... [1] http://blog.plover.com/prog/defunctionalization.html http://www.brics.dk/RS/01/23/ http://cristal.inria.fr/~fpottier/publis/fpottier-gauthier-popl04.pdf -- Live well, ~wren