Proposal: Add setEnv/unsetEnv to "base"

Simon Hengel sol at typeful.net
Fri Oct 5 10:19:51 CEST 2012


On Wed, Oct 03, 2012 at 12:49:19PM -0700, Evan Laforge wrote:
> On Wed, Oct 3, 2012 at 12:10 PM, Simon Hengel <sol at typeful.net> wrote:
> > On Wed, Oct 03, 2012 at 08:27:21PM +0200, Gregory Collins wrote:
> >> +1 (a no-brainer, in my opinion) --- although you can get rid of
> >> unsetEnv if you make setEnv take a "Maybe String", which might be
> >> better.
> >
> > I haven't pointed that out, because it's documented in the Haddock
> > comments, but 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.
> 
> I notice setEnv documents this, but maybe you could add a line to
> document why?  Readers are likely to be thinking "that's a dumb
> design", at least you can deflect the blame over to windows.

I gave it a try on my "blame-windows" branch [1].  It's more text now,
so the important thing (== how does setEnv behave) may be easier to
miss.  Not sure, opinions?

For comparison, the previous version is at [2].

Cheers,
Simon

[1] https://github.com/sol/setenv/blob/blame-windows/src/System/SetEnv.hs#L33
[2] https://github.com/sol/setenv/blob/master/src/System/SetEnv.hs#L33



More information about the Libraries mailing list