4 ms·
> Additionally, as a matter of culture, Haskell programmers rarely throw exceptions. The writers of unix and other base libraries would disagree. See for examp
by wereHamster 13y ago
> 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.
- Peaker 13y agoOr replace head with a better function.
- mercurial 13y agoSee the fantastic errors module, which has safe versions of head, etc.
- epsylon 13y agoOr use pattern matching.
- mercurial 13y agoPattern 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.