public static void quicksort(int[] arr) {
  quicksortHelper(arr, 0, arr.length);
}

Code flip

partition :: (Ord a) => STArray s Int a -> Int -> Int -> ST s Int partition arr start end = do pivotElement <- readArray arr start let pivotIndex_0 = start + 1 finalPivotIndex <- execStateT (mapM (partitionLoop arr pivotElement) [(start+1)..(end-1)]) pivotIndex_0 swap arr start (finalPivotIndex - 1) return $ finalPivotIndex - 1