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

> Additionally, as a matter of culture, Haskell programmers rarely throw exceptions.

The writers of unix and other base libraries would disagree. See for example `head`. Or most functions that calls into C where the C function fails with an error. In that case Haskell blows up into your face, and you have to wrap the function invocation in a catch.



Or replace head with a better function.


See the fantastic errors module, which has safe versions of head, etc.


Or use pattern matching.


Pattern matching is great, you can usually use it instead of head, but you want something like Control.Error.Safe.tryRead to replace other unsafe functions like read.




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

Search: