Swirly Mein Kopf

Thursday, July 11. 2013

Running Circle Packing in the Browser using Haste


Half a year ago, I wrote a small Haskell library called circle-packing to pack circles in a tight arrangement. I used this to experiment with the fay compiler, which compiles Haskell to JavaScript, and the result was quite nice.

Recently, I was pointed to haste, another Haskell-to-JavaScript-compiler, and gave it a shot. It required no changes to my code, and after a bug in the compiler was fixed, I could successfully run the example compiled with haste. Some observations:

  • Haste provides more features that I consider necessary for it to be used seriously. In particular its support for Cabal (so I could just write haste-inst install circle-packing) and its support for a much larger subset of Haskell, including type classes, as it builds on GHC.
  • Interfacing with JavaScript is not as smooth as in fay. Especially having to write JS code in a separate helper file is annoying.
  • A quick unscientific comparison of the two results indicates that the code produced by haste is a bit faster (although I should maybe compile the fay variant with the latest version).


No Trackbacks


Display comments as (Linear | Threaded)

No comments

Add Comment

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.

Gravatar, Favatar, Identica author images supported.
What is the first name of the owner of this blog? / Wie heißt der Betreiber diess Blogs mit Vornamen?
Nach oben