returns library
throughout hive, especially in the VehicleState FSM, there are methods with the following signature:
Tuple[Tuple[Exception], Tuple[T]]
where T may be SimulationState, or, some kind of vehicle state, or others. this describes a method which can fail, do nothing, or possibly return a T, and we allow these instances:
error, None # experienced an error
None, t # result of method, no error
None, None # method fails without an error
where the combination "error and a result t" is disallowed.
this is based off the idea of the error-first callback in Node.js, but, also simulates a low-tech version of the Either monad from Scala. the Returns library also has it's implementation of this, with the Result and ResultE types.
Result would reduce our signatures from Tuple[Tuple[Exception], Tuple[T]] to ResultE[T], but, it also brings a lot more with it, some of which may be awkward to integrate into our code base. do we consider using Result?
alternatively a low-tech solution (which doesn't protect us as well from dev errors): should we simply add a type alias for Tuple[Tuple[Exception], Tuple[T]]:
T = TypeVar('T')
Result[T] = Tuple[Tuple[Exception], Tuple[T]]
Another overlapping issue: #84
We should probably merge this with #84 and possibly break out into sub issues
Also make sure we deal with cases where the simulation state is None appropriately.