[GHC] #5930: add System.Environment.lookupEnv which returns Maybe instead of an exception

GHC cvs-ghc at haskell.org
Mon Mar 12 03:32:02 CET 2012


#5930: add System.Environment.lookupEnv which returns Maybe instead of an
exception
------------------------------+---------------------------------------------
 Reporter:  elaforge          |          Owner:                  
     Type:  feature request   |         Status:  new             
 Priority:  normal            |      Component:  libraries/base  
  Version:  7.4.1             |       Keywords:                  
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
  Failure:  None/Unknown      |       Testcase:                  
Blockedby:                    |       Blocking:                  
  Related:                    |  
------------------------------+---------------------------------------------
 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 at haskell.org 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.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5930>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the Glasgow-haskell-bugs mailing list