[Haskell] Re: Top Level TWI's again was Re: Re: Parameterized Show

Benjamin Franksen benjamin.franksen at bessy.de
Tue Nov 23 08:21:13 EST 2004

On Tuesday 23 November 2004 00:10, Aaron Denney wrote:
> On 2004-11-22, Benjamin Franksen <benjamin.franksen at bessy.de> wrote:
> > On Monday 22 November 2004 09:38, Adrian Hey wrote:
> >> You have yet to
> >> explain how you propose to deal with stdout etc..
> >
> > I see absolutely no reason why stdxxx must or should be top-level mutable
> > objects. They can and should be treated in the same way as environment
> > and command line arguments, i.e.
> >
> > getArgs :: IO [String]
> > getEnv :: String -> IO String
> > getStdin, getStdout, getStderr :: IO Handle
> >
> > Note that (just like environment and command line arguments) these
> > handles may refer to completely different things on different program
> > runs.
> Er, no.  The handles can be considered as the same but _pointing_ to
> different things on different runs.

I wrote "may refer to", not "are", so yes.

> Keeping them outside the IO monad, 
> and only accessing them inside -- i.e. the current situation -- would be
> fine.

I beg to differ. Note, I do not claim they are unsafe.

> They're not mutable in any sense.

Well, a variable in C is not mutable in exactly the same sense: It always 
refers (="points") to the same piece of memory, whatever value was written to 
it. Where does that lead us?

Top level things with identity are evil.	-- Lennart Augustsson

More information about the Haskell mailing list