Simple reinterpretation of the Promise pattern for Haxe