> What do folk out there think to the idea of having a std module
> in Haskell which contains dynamic environment info.
> things I mean are
>
> progName :: String
> args    :: String
>

Representing the 'args' as a value in haskell is probably not
the right thing to do. For one thing, it is not possible to substitute the
value 'args' with its definition, since it is unknown until load time.

I think that the 'dynamic environment' info is much better represented with
implicit arguments. (already implemented by Jeffrey Lewis in the november
hugs release).
(Implicit Parameters: Dynamic Scoping with Static Types. Jeffrey Lewis, Mark
Shields,
Erik Meijer, John Launchbury:
http://www.cse.ogi.edu/~mbs/pub/implicit.ps.gz )

The type of main would than be:

> main :: (?arguments, ?environment) => IO ()

And we could use these arguments anywhere in the haskell program
(without making everything part of the IO monad)

> numArgs :: (?arguments) => Int
> numArgs  = length (?arguments)

Actually, the H/Direct compiler uses an unsafePerformIO to avoid having to
pass around options through all the compiler. Implicit arguments would help
here too.

All the best,
        Daan.

Reply via email to