A Trifle Absurd
Matthew Morgan’s software notions
Choosing Haskell Was a Mistake
28 November 2005 at 18.11 • in Trifle, HaskellI’m going to drop Haskell as Trifle’s development language and go back to plain ol’ Objective-C. I still love Haskell the language, but I have to reluctantly admit that it just doesn’t make sense in this context.
Trifle will be a user-interaction-focused app. Most of the code will be directly interacting with or extending Cocoa objects. If I did that in Haskell, it would amount to writing Objective-C code with Haskell syntax. And even the stuff that was independent of Cocoa, like document data and rules, would still have to be structured to interact with the GUI code somehow. I’d spend way too much time working on crossing the chasm between Haskell and Objective-C.
Moving to Objective-C has its advantages, too. I can use XCode and its associated tools for debugging, profiling, and leak detection. I can easily generate universal binaries, rather than cobbling something together by hand. I’ll have a smaller executable with fewer dependencies. I can take advantage of Objective-C-entwined stuff like Cocoa Bindings.
I have mixed feelings about this switch. I’m bummed to set Haskell aside; it’s a great language, and fascinating to program in. I’m also sorry to give up garbage collection. But I’m convinced I gain more than I lose, in this situation. The way forward looks much clearer, and I’m reenergized to jump into Trifle anew.
Cocoa Bindings and Haskell
21 November 2005 at 15.38 • in Mac, HaskellI’m wondering if Cocoa Bindings are any use to me as a Haskell developer. The whole point of Bindings is to take data from a preexisting Objective-C object and display it in a view, with appropriate syncing in both directions. But if I’m using Haskell data structures to begin with, I’d have to add an extra layer to sync the data with an Objective-C object for Bindings to connect to.
Wouldn’t I be better off eliminating that extra layer, and just implementing my own NSTableDataSource (or whatever) that knows how to interact with Haskell data? Or is there an advantage in having an NSArray in the middle for Bindings and Haskell to interact through? I suppose there are hybrid approaches: I could implement an object that supports the NSArray interface for Bindings’ sake, but actually is all Haskell underneath.
Dazzle
23 September 2005 at 19.21 • in HaskellOn the heels of my decision to use Haskell, there’s an encouraging paper: Haskell Ready to Dazzle the Real World, by Martijn M. Schrage, Arjan van IJzendoorn, and Linda C. van der Gaag. From the abstract:
Haskell has proved itself to be a suitable implementation language for large software projects. Nevertheless, surprisingly few graphical end-user applications have been written in Haskell. Based on our experience with the development of the Bayesian network toolbox Dazzle, we argue that the language is indeed very well suited for writing such applications.
The paper gives examples of the abstractions used in Dazzle, most of which generalize to any GUI application. I particularly liked their method of interleaving progress-bar updates with pure computation.
Mostly, though, it’s just heartening to see a real example of an ordinary GUI app in Haskell—and to know that the authors are delighted they chose Haskell. It gives me hope that I’m on the right track.
Why I Chose Haskell
20 September 2005 at 17.10 • in Trifle, Languages, HaskellI’m trying to build an application to sell, with the highly practical goal of making a living. So why on earth would I pick a wacky academic programming language that hardly anybody uses?
Because I need leverage. I’m developing Trifle on my own, so I need the most powerful tools I can find. Haskell is a very powerful and high-level language: my code works sooner than I expect, and is shorter and simpler than I expect.
Because it fits the situation. Of the various high-level languages I had to choose from, Haskell was the best fit: it has an Objective-C bridge, an active user community, and decent performance.
Because I can. At a regular programming job, the language choice would be a given, handed down from on high (like many other choices). One of the biggest benefits of working independently is getting to make my own decisions. I think Haskell is the right choice, so I’m going to use it. Where else would I get that opportunity?