HaSh - The Haskell Shell (Home Page)

What is HaSh?

HaSh is a nascent project to produce a shell scripting system based on the Haskell programming language. No code has yet been written. This is the home page for the people interested in the project, whether designing it, building it, documenting it, testing it, or using it.


Shortcuts

Design Notes Mailing List The Library

What is Haskell?

Haskell is a functional programming language. Unlike languages like Lisp, Scheme, and even ML, Haskell is pure, in that assignment is not a feature provided by the language. Haskell is also unusual in that it is lazy, which is to say no expression is evaluated unless it absolutely must be.

There is lots of information about Haskell, both in bits and atoms. The best place to start online is the Haskell Home Page.

For a book, I'd recommend Simon Gibb's book, Haskell - The Craft of Functional Programming . It isn't really a book for new programmers, but it is fairly comprehensive.

See the Library for more books on relevant topics.

Why HaSh?

Obviously, making a Haskell shell is just a nice exercise unless the shell provides significant benefits over existing shells. One component I see there is Haskell's language features: laziness, strong typing, and overall rationality. The other aspect to HaSh that could make it beneficial is if it was more elegantly integrated into a desktop environment than the usual shells.

Language Features

Laziness, I think, works quite well as a higher-level model of processes, especially daemons. A process sleeps until it is specifically requested to provide some information or take some action.

Strong typing is something not usually found in shells. The reasoning behind this is that strong typing gets in the way of rapid prototyping, which is the kind of work shells are ostensibly designed for. We all know, however, how many web sites depend on shell scripts (and I include Perl here) running as a CGI script. But what about interactive use? Isn't a type error annoying when all you're trying to do is "ls"? Given Haskell's polymorphism, I'd suggest that if you do get a type error, you probably wouldn't have gotten what you wanted under a weakly typed shell anyway.

Finally, Haskell's overall rationality, by which I mean the ability to reason about the code you write. This is something of unique value for system scripting, I think. Too many people know the "joke" about Perl being a write-only language. Having a scripting language with the undeniable utility of Perl, but the clarity of Haskell, well that would be quite something, wouldn't it?

Desktop Integration

Most shells simply run in a terminal window - X Term or Kvt or some such. This has led to a lot of (unjustified) bad press for Unix in general and Linux in particular. Non-geeks see shells as too arcane for "normal humans."

But what about a shell makes it intrinsically difficult to use? Three things:

Arguably, Haskell's syntax is cleaner than many shell languages. This of course is flame-bait, so I'll discuss it no further.

In the past, graphical shells or visual programming languages have often either scaled poorly or been clumsy enough that they were not sufficiently useful. "Visual" environments like Visual Basic are productive largely because they simplify repetitive tasks required by many poor UI libraries. Haskell itself should scale nicely. Simplifying repetitive tasks is what shell scripts do naturally. By making it easy to create graphical shell scripts, even just push-button icons corresponding to Haskell expressions, we may have a tool that turns out to be quite useful.

Finally, we have the question of making the shell desktop-aware. The ability to drop and drag files onto HaSh expressions springs to mind as something that could be quite useful. This might permit, for example, an elegant and obvious way to run a command in one directory on files in others.


©Brook Conner
Last modified: Sat Aug 21 00:34:49 EDT 1999