Proposal: System.Environment.getEnv should return Maybe

Brandon Allbery allbery.b at gmail.com
Thu Feb 23 01:06:02 CET 2012


On Wed, Feb 22, 2012 at 18:51, John Meacham <john at repetae.net> wrote:

> On Wed, Feb 22, 2012 at 3:05 PM, Evan Laforge <qdunkan at gmail.com> wrote:
> > It's awkward and surprising how getEnv throws an exception when an env
> > var is not set, since it's very common for env vars to be optional,
> > and it's not convenient to catch exceptions in haskell (I have to look
>
> For true IO exceptions, you should be using the Prelude.catch mechanism.
>

This still assumes that it's an exceptional condition that is being
modeled.  It is not; it is correctly modeled as a Maybe.

-- 
brandon s allbery                                      allbery.b at gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20120222/1f4dc0be/attachment.htm>


More information about the Libraries mailing list