Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> I guess you need IO to run anything at all

Its a bit more that that. You need to be in IO in order to catch an exception.

That is to say, if you have:

   bam :: (Int, Int) -> String
There is no way to write:

  bam (x,y) = "bar" if x is called first
                     "baz" if y is called first.
However, if you were to instead have:

  bam :: (Int,Int) -> IO String
Such a function is possible to write, as you can now catch the exception and do something with it.


Fair enough [edit: distinction to make], but the problem is still the existence of exceptions (at least as something that doesn't always terminate the process, but that's implied by most useful definitions of "exception" anyway), not anything that would be true of a hypothetical alternate version of Haskell that still had IO, but didn't have exceptions.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: