flatten non-IO bound code