21 lines
606 B
Text
21 lines
606 B
Text
--| `sort` sorts a `List` of `Natural`s in ascending order
|
|
λ(nix : ../NixPrelude.dhall) →
|
|
let Any = ../Any/Type.dhall
|
|
|
|
let Any/toAny = ../Any/toAny.dhall nix
|
|
|
|
let Any/toTypeUnchecked = ../Any/toTypeUnchecked.dhall nix
|
|
|
|
let Any/lessThan = ../Any/lessThan.dhall nix
|
|
|
|
let coerceList =
|
|
λ(from : Type) →
|
|
λ(to : Type) →
|
|
λ(list : List from) →
|
|
Any/toTypeUnchecked (List to) (Any/toAny (List from) list)
|
|
|
|
in λ(xs : List Natural) →
|
|
coerceList
|
|
Any
|
|
Natural
|
|
(nix.builtins.sort Any/lessThan (coerceList Natural Any xs))
|