I didn’t re-order them to make it faster - I know that makes no difference.
What I am trying to say is that this signature was included to allow a more efficient implementation, the alternative would be:
updateDatum : (a -> a) -> Zipper a -> Zipper a
which means the caller must first walk a Zipper to the right location. This signature allows the Path to take a short-cut, by using the id of the datum more directly:
updateDatum : (a -> a) -> Path -> Tree a -> Tree a
I put the function a -> a
first as then it becomes slightly easier to write functions for particular update operations that are then applied to specific paths and trees:
togglePath = updateDatum toggleDatum
and so on. It is quite common with map
functions to put the transformation function first.