You are here

OK, Haskell

I learned some more Haskell tonight. That's happened a lot of times, though, over many years. I think I'm finally getting the IO monad kind of straightened out, so maybe I'll be OK with the language, finally...

Jamey just wrote some Haskell code to put a Haskell front end on the XCB backend, effectively making XHB. Or at least a start at it—there's a lot more work to do.

I'm seriously working on an X toolkit atop XCB, Cairo, and Pango for my oddball idea about what a GUI should be. (Hing: the whole desktop metaphor kind of sucks. I want something more like a book or a webpage as the top-level construct. And yes, I used to play #initgame quite a bit. Wish it was still around, but haven't seen it anywhere for ages.) Jamey has inadvertently tempted me to do it in Haskell. This is bad: I don't have time for it. Of course I don't really have time to do the toolkit anyway.

I don't want to get into the joys of learning Haskell here. Suffice it to say that my students have helped me get it, my faculty colleagues have helped me get it, Simon Peyton-Jones has helped me get it. Now I'm finally getting it. I guess I'm just a slow learner. I had the same problem with Perl: it took me three runs at it to get it right.

But I can see the attraction of Haskell, definitely. It's got some real beauty to it, and I want and apparently need to learn more. It's just going to be slow going.

Here's what I wrote tonight, more or less:

---cat in Haskell, compilable with GHC
---Bart Massey 2006/01

import IO

main :: IO ()
main = try getChar >>=
         (\e -> if isEOFError e then return () else ioError e)
         (\c -> putChar c >> main)

Sure looks worth several hours work, eh? (Also, why is the formatting so messed up, at least in my browser? Does the <pre> tag not do what I think it does?)

Oh well. At least I learned something today.