Trading Haskell for a New Language

After committing to Haskell for my new language in 2007 it was largely a failed experiment. I never found a good learning Haskell book. I went through a few tutorials and nothing really clicked much. I found myself wanting to hack around on Ruby rather than mess around with Haskell syntax.

I really prefer a comfortable well-written book introduction to a new language. Something like the Ruby Pickaxe book or Learning Perl. Maybe this year will be Erlang or Common LISP since they both seem to have nice introductory books available.

Haskell and Tabs

Today, I learned Haskell doesn’t like tabs. Haskell apparently uses some syntax conventions to connote things like blocks. I was working my way through a Haskell tutorial when I found the following snippet of code kept getting compiler errors:

fails
main = do putStr "You are? "
          name <- getLine
          greet name

Turns out you can also enclose a block in angle brackets so this code worked

compiles
main = do { putStr "You are? ";
name <- getLine;
greet name }

Then it dawned on me. My TextMate Haskell setting were showing

1
Hard Tabs

instead of

1
Soft Tabs

with spaces. Flipping it to use spaces made the same code pass compilation.

compiles
main = do putStr "You are? "
          name <- getLine
          greet name

Experimenting with lining up the arguments after the do showed that all of the statements had to line up vertically. Thus this reasonable looking syntax would fail:

fails
main = do putStr  "You are? "
                  name <- getLine
                  greet name 

I’m still very much at the beginnings of digging into Haskell, but it’s nice to play around with a language purely for intellectual curiosity.

Getting Started on Haskell

I made a little headway on Haskell today.

Downloaded the GHCI environment to start running/compiling in Haskell. Had to find the Mac Intel port. Went looking for at least a TextMate bundle, turns out there is a pretty basic one available. Then started one of the basic Haskell tutorials.

After just an hour or so I feel like I’m on another planet, but that was the desired effect. Next up getting HUnit up and running.

Tech Support Over the Holidays

As with many techies I did some tech support for myself and relatives over the weekend:

  • Setup my in-laws backup solution to an external hard drive and did their first full backups. This took some time just because backing up about 200GB across two machines isn’t that fast.
  • Setup a wireless network for my in-laws. Super simple since they just bought an Airport Express at a garage sale. Plug it in, and do a reset and we’re done. Five minutes tops.
  • Finally upgraded from WordPress 1.5 to 2.0. Not much in the way of a difference, but at least I can feel a little more secure I’m not open to a host of security bugs.

At midnight I may celebrate by writing Hello World in Haskell.