Parametrized A* over distance function and shouldConsider predicate
Use this noop ~: trick to avoid automatic uncurrying