|
|
|
|
|
by oftenwrong
2845 days ago
|
|
If you application is interacting with the outside world, you will be dealing with side-effects, and sometimes error conditions will happen. For example, today I am working on a service that: - uses a database - calls external APIs - publishes and consumes from a message broker - interacts with local and remote filesystems over a variety of protocols All of these things entail error conditions, most of which throw exceptions in the corresponding libraries. Sometimes they are converted to Either/Maybe, and sometimes they are wrapped in "native" checked exceptions. The important bits: 1. The type system and compiler make sure the programmer has to deal with the error conditions at some point. From a programmer's perspective, a checked exception bubbling up the stack is not very different from returning a monadic object up the stack. 2. The core of the application is entirely pure. No exceptions (in both senses of the word). All side effects are pushed to the boundaries. |
|