Orders functions, types, data and instances in foundation