mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-25 12:42:02 +03:00
10 lines
332 B
Idris
10 lines
332 B
Idris
import Data.Vect
|
|
import Data.Vect.Views.Extra
|
|
|
|
mergeSort : Ord a => {n : _} -> Vect n a -> Vect n a
|
|
mergeSort input with (splitRec input)
|
|
mergeSort [] | SplitRecNil = []
|
|
mergeSort [x] | SplitRecOne = [x]
|
|
mergeSort (xs ++ ys) | (SplitRecPair {xs} {ys} xs_rec ys_rec) =
|
|
merge (mergeSort xs | xs_rec) (mergeSort ys | ys_rec)
|