Moving from imperative programming to functional programming requires a fairly large shift in mindset. Moving away from your mutable variables and control flow loops to a streams-based system of handling side effects requires a similar shift in mindset.
A Task
encapsulates side effects. You can do just about anything you want in a Task
. A Process
as a stream of a specific piece of data. Think of it as a list of that data. For example, if you have a counter in your application, a single Process
would be used to represent that Int
. Think of a Process
as a function that holds state that waits to emit a value when it's asked to. A Process
is a state machine that can be in one of three states: emitting values, awaiting for the result of some request, or halted. It represents all values that you expect to get from your function. Those values could be simple, like a list of Int
s, or it could be far more complex, like asynchronously waiting for responses from a remote server.