util functions for the "Either" callback pattern