Opened 2 years ago

Closed 2 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 Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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 2 years ago.
tabs to spaces
0002-Add-System.Environment.lookupEnv-as-per-trac-5930.patch (2.6 KB) - added by elaforge 2 years ago.
add lookupEnv

Download all attachments as: .zip

Change History (6)

Changed 2 years ago by elaforge

tabs to spaces

Changed 2 years ago by elaforge

add lookupEnv

comment:1 Changed 2 years ago by elaforge

  • Status changed from new to patch

comment:3 Changed 2 years ago by pcapriotti

  • Difficulty set to Unknown
  • Owner set to pcapriotti

comment:4 Changed 2 years ago by pcapriotti

  • Milestone set to 7.6.1
  • Resolution set to fixed
  • Status changed from patch to closed
Note: See TracTickets for help on using tickets.