21 lines
602 B
Text
21 lines
602 B
Text
--| `sort` sorts a `List` of `Double`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 Double) →
|
|
coerceList
|
|
Any
|
|
Double
|
|
(nix.builtins.sort Any/lessThan (coerceList Double Any xs))
|