[ perf ] Do not split tree too early

This commit is contained in:
Denis Buzdalov 2023-09-27 19:50:59 +03:00 committed by G. Allais
parent 276d41d86c
commit f3eff838b2

View File

@ -441,10 +441,9 @@ export
split : Nat -> FingerTree (Elem a) -> (FingerTree (Elem a), FingerTree (Elem a))
split _ Empty = (Empty, Empty)
split i xs =
let MkSplit l x r = splitTree i xs
in if size xs > i
then (l, x `consTree` r)
else (xs, Empty)
if size xs > i
then let MkSplit l x r = splitTree i xs in (l, x `consTree` r)
else (xs, Empty)
-- Concatenation