Proposal Summary: Add setEnv/unsetEnv to "base"

Simon Hengel <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc,gmane.comp.lang.haskell.libraries
Message-ID <20121118194349.GA31091@x200>
> I propose to add setEnv/unsetEnv to System.Environment, so that it is
> easier to write applications that behave the same on POSIX and Windows
> systems.

I finally prepared a patch for "base" [1].  Contrary to what I
originally assumed, getting it right on POSIX systems is much harder
than on Windows.

Here is the summary of the discussion:

As I understand it, Duncan Coutts, Gregory Collins, Edward A. Kmett and
Ben Millwood support the proposal.

Gregory Collins noted that

> you can get rid of unsetEnv if you make setEnv take a "Maybe String",
> which might be better.  Ultimately though, who cares what color the
> bike shed is painted :)

And I explained that

> on Windows, setEnv "FOO" "" will remove FOO from the environment.  I
> don't particularly like it, but as my stated goal was to provide the
> exact same behavior on all platforms and there is no way to work
> around this on Windows my implementation does the same thing.
>
> People who don't care for Windows support and want to set an
> environment variable to the empty string can still use "unix".
>
> So short answer: setEnv already supports removing.
>
> We could still remove unsetEnv from the public interface.  I have no
> fixed opinion on that, so I'm very open for suggestions.

Evan Laforge and Wren Thornton then provided valuable feedback on how to
improve the documentation, which I addressed.

There were no major concerns or rejections.

Cheers,
Simon

[1] http://hackage.haskell.org/trac/ghc/ticket/7427
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.