Use state monad fns in order-by.