HaSh -- the HAskell SHell

This page is my rough notes on what would be involved in a Haskell shell. I make no claims for any code, or that any of the concepts are in any way final, good, etc. These are raw brain sewage from my brain back to my own brain. Feel free to mail me comments, questions, etc.

HaSh - the Haskell Shell
KHaSh -- the KDE-enabled HaSh
HooKHa -- Hash's object-oriented KDE-panel of Haskell expressions and
applications.  Grab a process, expression, whatever, put it in the
hookha, and "smoke it" whenever you want.

Aug 5, 1999, 10pm

What is the type of "ls"? Or of any shell command?

A Monad type?

A function from a shell environment to another? But what about side
effects?

How about the type of a Process?

type Process t = 
             Running t    -- ps R
             Sleeping t   -- ps S
             Suspended t  -- ps D
             Stopped t    -- ps T
             Zombie t     -- ps Z

And what can "t" be above? 
  Executable (i.e., native code executable),
  Script (i.e., running in some kind of interpreter), -- do we need this?
  Expression (Haskell expression).

So constructors for Process t would include
foreground t.constr -- usually Running t, alias fg
background t.constr -- usually Running t, alias bg
hookha t.constr     -- usually Sleeping t?, alias hk
nice t.constr       -- either Running t or Sleeping t, depending

Constructor for Executable would be
findInPath String -- hmm, what about / and the like? They're legit in
Unix, I think, just hard to get past the shell..... This has an alias
of path String or a unary operator or something

Vaariable number of arguments?

Regexps?


Modifying the syntax to produce something useful, though perhaps less
elegant?

What about par and seq? OR implicit in Monad use! No need for fg and
bg, etc. Default is background (lazy). You want order, use >>=
Alias | to >>=  ?

cat foo >>= lines >>= filter (/// "a.*")
returns a list of lines from foo that contain a match of "a.*"

so some shell command types:

ls :: Path t -> [ Path t ] -- how do you handle options?

-l :: Path t -> Path Decorated t -- hmmm, just may be on to
something. Suggests polymorphic regexps over paths

Or is a directory a set, containing files. Files can be directories,
too, of course. Maybe files are clustered with their types:

case ls pwd of
   (application/*, name) -> par name -- or Monad name?
   (image/*, name)       -> xv name  -- foreground - doesn't continue
                                     -- until click?
   _ -> Nothing

How can we use \foo (lambda expressions)? Options?

ls \f -> attr f -- too long-winded next to ls -l, but consistent
across everything! But ls took a Path t, not a t -> Attr t
How polymorphic is ls?


Aug 6, 1999, noon

"reverse" args?

sort reDate attr ls pwd

so this suggests
pwd :: Monad Path
ls :: Monad Path -> [ File ]

Modify name lookup to search the directory and path after the local
namespace? I think this might work reasonably elegantly. This suggests

stdio :: Monad String
stderr :: Monad String
stdin :: Monad String

© Brook Conner, 1999. All rights reserved, except that this document may be freely copied and distributed in electronic form only, so long as this copyright notice remains attached and no charges, fees, or other monies are collected.