Erroring and handling exceptions
Haskell very intentionally does not have a null
/None
/nil
value like many popular languages have, both strongly typed (Java) or not (Perl). Null values are exceptionally bad for program safety. Null values are not expressed in types, giving nulls no choice but to hide from the unsuspecting programmer and pop into sight in production.
Nulls are one of the main causes of bugs and security holes in today's software, which is why Haskell has opted for a no-null policy. This might sound restrictive at first, but actually the alternative representations for possibly failing computations in Haskell are various and rich.
First, there are infinite ways to embed the possibility of failing into the datatype: Maybe, Either, ...
Get Haskell High Performance Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.