I often see claims that modern functional strictly-typed languages are 'safer' than others. These statement mostly linked with type systems and their ability to explicitly express the following sources of pitfalls:
- Alternatives in function result. Maybe and Either datatypes vs. exceptions and null-pointers in C++-like languages.
- Access to mutable state (possibly inconsistent behavior over time). State datatype in Haskell vs. variables in C++-like languages.
- Performing IO. IO datatype in Haskell vs. just doing things in C++-like languages.
Haskell compiler is able to warn programmer when he doesn't properly handle theses kinds risky operations.
Althought pitfalls above are definitely the most common ones I can see much more, for example:
- Unexpected resource consumption. Memory or CPU, the former is common for Haskell AFAIK.
- System-level failure. Like crashing process or pulled plug.
- Unexpected execution time for IO, timing violation.
Is there languages, libraries or at least models which allow to express risks from the second set and yield a warning when they are not handled?