A quick programmer’s look at NVIDIA’s CUDA

I spent a while this evening reading through the documentation for the beta release of NVIDIA’s CUDA GPGPU system. My motivation for this was that nvcc, the CUDA compiler, is based on a code drop of the EkoPath compiler, which I’ve worked on intermittently over the past few years. The programming model that these GPUs enforce is incredibly complex. It’s more than a little reminiscent of the Connection Machine (for a blast from the past, see a collection of scanned CM-5 documentation. ...

22 February 2007 · 5 min · Bryan O'Sullivan

Haskell Cabal, now with extra crunchy RPM goodness

The Haskell community has a very nice implementation-independent mechanism for building libraries and applications, called Cabal. I spent a few hours over the past couple of days hacking on Cabal to add the ability to build RPM packages. You can fetch my darcs repository from here: darcs get --partial http://darcs.serpentine.com/cabal-rpm This new capability is easy to use. It adds a single new Cabal command, called rpm. runhaskell Setup.*hs rpm This generates a spec file, and builds source and binary RPMs. ...

20 February 2007 · 2 min · Bryan O'Sullivan

Esh, the fabulous, forgotten Scheme implementation

In 1995, I moved from Ireland to the San Francisco Bay Area, because I’d been offered a job that promised to combine Unix and Scheme hacking. The prospect tickled me pink. At Sun Microsystems, the SPARC design team used a home-built tool called DReAM to manage their ranch of servers as they ran huge batches of EDA design synthesis, verification and simulation runs. I was to join the DReAM group to maintain and extend the software. ...

16 February 2007 · 2 min · Bryan O'Sullivan

Anatol Rapaport on argument

Here’s a wonderful excerpt from a book review written by Daniel Dennett, in which he paraphrases Rapaport on how to argue constructively. Serious argument depends on mutual respect, and this is often hard to engender when disagreements turn vehement. The social psychologist and game theorist Anatol Rapoport (creator of the winning Tit-for-Tat strategy in Robert Axelrod’s legendary prisoner’s dilemma tournament) once promulgated a list of rules for how to write a successful critical commentary on an opponent’s work. First, he said, you must attempt to re-express your opponent’s position so clearly, vividly and fairly that your opponent says “Thanks, I wish I’d thought of putting it that way.” Then, you should list any points of agreement (especially if they are not matters of general or widespread agreement), and third, you should mention anything you have learned from your opponent. Only then are you permitted to say so much as a word of rebuttal or criticism. I have found this a salutary discipline to follow-or, since it is challenging, to attempt to follow. When it succeeds, the results are gratifying: your opponent is in a mood to be enlightened and eagerly attentive. ...

15 February 2007 · 1 min · Bryan O'Sullivan

Parsing a simple config file in Haskell

Even though I wrote my Haskell blog helper tool purely for my own use, I don’t want to store hard-coded strings in it, lest my username and password escape into the wild. This suggests that I need a small config file of some kind. I’m going to walk through the parser I wrote for this config file, not as a tutorial, but as an example of how to solve a simple pratical problem in Haskell. ...

1 February 2007 · 7 min · Bryan O'Sullivan

Blogging with Emacs and Haskell, part Zero

Since I started using WordPress to host my blog, I’ve generally been fairly pleased with it. Its killer feature has to be Akismet, the built-in spam filter. Akismet has so far killed over 18,000 spam comments for me, or roughly 300 per day in the two months since I switched from Blosxom to WordPress. Perhaps one in fifty spam comments make it through Akismet’s filters, at which point they’re easily dealt with via the web interface. So Akismet makes the difference between manageable comments and having to turn them off entirely. ...

31 January 2007 · 2 min · Bryan O'Sullivan

Beautiful graphics manipulation (in Haskell, artistic flair required)

During my evening’s Haskell-related Googling, I came across a piece of software called Pancito, written by Andrew Cooke. Pancito is a Haskell package for manipulating images, and Andrew has a beautiful gallery of some of the work he’s done with it. It’s well worth a look. (How did I find Pancito? Because I was playing with tree folds.)

20 January 2007 · 1 min · Bryan O'Sullivan

Playing fast and loose with Parsec for parsing in Haskell

For the past number of years, whenever I’ve needed to write a parser for a language, I’ve turned to Terence Parr’s ANTLR. It’s a wonderful piece of software, far more capable than the old standbys lex and yacc. Just as appealing is the fact that it generates recursive-descent parsers that are easy to read and debug. Compare an ANTLR-generated parser with the pages of pushdown automaton state transition muck that yacc and its descendants generate and you’ll quickly appreciate the clean nature of ANTLR’s code. In the Haskell world, a close approximation to ANTLR is available in the form of Parsec, a library for building parsers using combinators. Where ANTR has its own special syntax, and you run a tool that generates code in some target language, you construct a Parsec parser entirely in Haskell. The Parsec documentation is excellent, with a great tutorial that makes it clear how easy it is to use Parsec to build a parser. In my case, I wanted to parse a simple language that has some structure, but no formal grammar, and a few nasty corners. This language makes heavy use of key/value pairs, in which the keys and values are usually just contiguous non-whitespace strings. In other words, a typical pair might be “foo=bar”, or “offset=17”. Sequences of pairs are separated by white space, so three pairs might look like “a=1 b=2 c=3”. It’s easy to recognise one of these pairs. ...

19 January 2007 · 5 min · Bryan O'Sullivan

New Haskell packages for Fedora Extras

Rather than bemoan the state of prepackaged Haskell goodness for Fedora, I’ve started down the path of doing something about it. This morning, I put together new packages for Alex, a Haskell lexer, and Happy, a parser generator, and submitted them for consideration via the byzantine Extras review process. If you’re a Haskell hacker and Fedora user, please take a look at bugs 223486 (Happy) and 223490 (Alex).

19 January 2007 · 1 min · Bryan O'Sullivan

Attention, the Soviet herring fleet!

From the department of microscopic obsessions of the bourgeoisie: I’ve subscribed to The New Yorker since I first came to the US, over a decade ago. On a mailing list, a correspondent alerts readers to this blog entry, which tickled me pink. Q. Is it true that at some point in the seventies, Goings On About Town used the listings for The Fantasticks to serialize James Joyce’s Ulysses? Jon writes: Yes. The New Yorker began serializing Ulysses in the November 3, 1968 listing for The Fantasticks, which famously ran for 17,162 performances, or nearly 42 years. That issue quoted the copyright information from the third printing of the novel (London, Egoist Press). The book’s opening words–“Stately plump Buck Mulligan came from the stairhead bearing a bowl of lather on which a mirror and a razor lay crossed”–appeared in the Dec. 21, 1968, issue. The serialization lasted almost three years, ending in November of 1971, and encompassed the entirety of the book’s first chapter. […] Asked about reader response to the serialization, [New Yorker editor Gardner] Botsford observed, “Many are delighted they can identify the excerpts, but others think we are trying to communicate with the Russian herring fleet in code.” Everybody loves easter eggs. ...

13 January 2007 · 1 min · Bryan O'Sullivan