Saturday, November 07, 2009

Haskell Revisited

Yeah, I'm back to looking at it and it really wasn't by choice. You see, I created a small program using D to launch scripts based on some parameters specified in a config file. We need this at work to be able to run some scripts on Windows and Linux. Instead of having to maintain two sets of scripts and batch files are very limited in what they can do, so using a small program seemed like the best way to go. It worked very well except it was compiled against a different version of glibc than what was on the target system. I guess that's not too bad considering it was the only bug found :-)

So, why the visit back to Haskell land? Well, outside of LDC, there's no real 64-bit compiler. This confuses me a bit since 64-bit systems are becoming more popular, so why wouldn't Digital Mars have an official 64-bit compiler? Yeah, got me. So, I figured I'd switch to a language that does have 64-bit support, but something newer that has facilities to write safer and better programs without needing a VM. Haskell seemed to be a good choice, so figured it would be a good choice. Also, I was listening to some presentations related to Erlang, Haskell, and functional programming, so I guess I drank some of the functional programming kool-aid :-)

Well, so far I'm hating it. Perhaps I'm just not in the right frame of mind, but it seems to be a pain so far to get command-line parameters working. I'm just following a tutorial with some changes to make it work the way I want to, however I'm getting a type error that's baffling me. Perhaps I just need to read the documentation some more, but it's frustrating that something that was very straight-forward in D isn't as nice to implement in Haskell.

Perhaps I'm jumping the gun, but command-line parameters should be easy to do in any language now. It's been done for years and, hell, just steal the GetOpt::Long from Perl like D did and be done with it. It works very well and is easy to use. However, I will say this much: Haskell at least supports the correct Unix/Posix style parameter format.

On a slightly different note, after listening to a presentation on Haskell, I'm wondering if perhaps D, which does have the concept of purity if you explicitly enable it for a function, should have functions be pure by default and explicitly make them impure. It's more consistent with their new thread local storage model and in reality, it's probably best to have the compiler assume and verify that functions are pure unless the programmer explicitly states otherwise. The big problem I see is that I/O becomes more difficult.

Labels: , , , ,

1 Comments:

Blogger Brandi said...

I don't know if this is the same Cornelius Sybrandy that was at Fort Gordon GA but if it is email me at brandibrandijo@gmail.com

5:17 PM  

Post a Comment

Links to this post:

Create a Link

<< Home