Opened 5 years ago

Closed 5 years ago

#5930 closed feature request (fixed)

add System.Environment.lookupEnv which returns Maybe instead of an exception

Reported by: elaforge Owned by: pcapriotti
Priority: normal Milestone: 7.6.1
Component: libraries/base Version: 7.4.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


getEnv throws an exception when the key isn't found, which is surprising and inconvenient. I'd prefer to change the signature of getEnv to return Maybe, but that will break people's code, so I'll settle for a new lookupEnv function.

It's been discussed on libraries@… and there was unanimous support.

Patches attached, the first cleans up mixed tabs and spaces (which I understand has been happening in ghc lately). The second adds the new function. Unfortunately I still can't get ghc to compile so it's untested for now. I'll keep trying with GHC, but I don't have a windows machine for testing.

Attachments (2)

0001-Whitespace-only-convert-mixed-tabs-and-spaces-to-spa.patch (3.3 KB) - added by elaforge 5 years ago.
tabs to spaces
0002-Add-System.Environment.lookupEnv-as-per-trac-5930.patch (2.6 KB) - added by elaforge 5 years ago.
add lookupEnv

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by elaforge

tabs to spaces

Changed 5 years ago by elaforge

add lookupEnv

comment:1 Changed 5 years ago by elaforge

Status: newpatch

comment:3 Changed 5 years ago by pcapriotti

difficulty: Unknown
Owner: set to pcapriotti

comment:4 Changed 5 years ago by pcapriotti

Milestone: 7.6.1
Resolution: fixed
Status: patchclosed
Note: See TracTickets for help on using tickets.