Algorithms for the order maintenance problem with a safe, yet flexible interface (http://hackage.haskell.org/package/order-maintenance)