
On Sun, Mar 11, 2012 at 16:33, Henning Thielemann < lemming@henning-thielemann.de> wrote:
On Sun, 11 Mar 2012, Brandon Allbery wrote:
Is looking up a missing key in a Map an exception?
It is certainly an exceptional situation. You want to know the value that is associated with a key, but the answer is not the wanted value, but no value at all.
So you will insist that lookup when the key doesn't exist throw an exception? If not, why not? If we're going to make interfacing with the system as difficult and minetrap-strewn as possible, then let's cut to the chase and switch to Agda. Or we need to change a bunch of IO (Maybe x) to throw approved exceptions and make them suitably difficult to use for our walled garden instead of thinking about whether that's appropriate. Or, just maybe, we just need to stop thinking of it's-in-IO-it-should-throw-an-exception-at-every-opportunity-instead-of-being-*usable*. IO's enough of a sewer as it is without turning it into don't-think-about-it-just-hork-a-hairball too.
"exception" in what sense? Certainly not an exception in IO, since I do not like the implicitness of exceptions in IO. No I think, Maybe is a perfect return type for 'lookup'. What I want to say is, that Nothing is also an exceptional value.
(So, you just tossed in