Task is not all about dealing with errors. Task has to be converted to Cmd to be executed by the Elm Runtime, and the execution of the Cmd may cause errors.
Our Elm code world is pure, so all the side effects are dealt by the Elm Runtime.
Cmd Msg is data itself, when it is passed to the Runtime, it is like saying
“hey Runtime, can You do this for me, when it’s done, pass back the
Whilst task is living in the Elm world, it is data too, it is like saying
’ I plan to do the follow things’
It is only when it is passed to
Task.attempt as an argument that it is converted to
Cmd and thus be executed by Elm runtime.
Tasks can be chained together, so it is very useful when you need a list of Cmd to be executed in sequential order.