mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-22 11:13:36 +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)
|