Proposal: Add setEnv/unsetEnv to "base"

Ben Millwood haskell at benmachine.co.uk
Wed Oct 3 21:29:48 CEST 2012


+1 to the original proposal – I think they are better as separate
functions. I can't see a common use case where you really want the two
behaviours unified, and it's probably better to keep the (I imagine)
vastly more common setEnv simple to use. Plus, it mirrors existing
practice with insertion/removal in e.g. Data.Map and Data.List. What
you suggest does sound reminiscent of a lens, though.

On Wed, Oct 3, 2012 at 7:27 PM, Gregory Collins <greg at gregorycollins.net> 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. Ultimately
> though, who cares what color the bike shed is painted :)
>
>
> On Wed, Oct 3, 2012 at 8:14 PM, Simon Hengel <sol at typeful.net> wrote:
>>
>> Hi,
>> setting environment variables is possible on both POSIX and Windows
>> systems.  Currently this functionally is missing from
>> System.Environment; the "unix" package provides an implementation for
>> POSIX systems.
>>
>> 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 implemented both in a way, so that they behave exactly the same on
>> POSIX and Windows (modulo case sensitivity on Windows).
>>
>> For now I prepared a standalone implementation [1] and corresponding
>> tests [2].  That implementation depends on the "unix" package.  If the
>> proposal is accepted, I will prepare a patch against "base" that
>> includes the relevant code from "unix".
>>
>> Discussion Period: 2 Weeks
>>
>> Cheers,
>> Simon
>>
>> [1] https://github.com/sol/setenv/blob/master/src/System/SetEnv.hs
>> [2] https://github.com/sol/setenv/blob/master/test/System/SetEnvSpec.hs
>>
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://www.haskell.org/mailman/listinfo/libraries
>
>
>
>
> --
> Gregory Collins <greg at gregorycollins.net>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>



More information about the Libraries mailing list