HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulefcf-containers-0.8.2Haskell2010

Fcf.Alg.Sort

Fcf.Alg.Sort

  • 10 types
datadata NatOrd (a :: Nat) (b :: Nat) (c :: Ordering)
#

Comparison for the Nats.

TODO: Would this fit to Fcf.Data.Nat on first-class-families?

Instances1Eval
  • type Eval (NatOrd a b) = CmpNat a bDefined in fcf-containers-0.8.2 · Fcf.Alg.Sort
datadata Qsort (b :: a -> a -> Exp Bool) (c :: [a]) (d :: [a])
#

Qsort - give the comparison function a -> a -> Exp Bool comparing your list elements and then Qsort will order the list.

Example

:kind! Eval (Qsort (N.<) '[5,3,1,9,4,6,3])

Eval (Qsort (N.<) '[5,3,1,9,4,6,3]) :: [TL.Natural] = '[1, 3, 3, 4, 5, 6, 9]

:kind! Eval (Qsort (S.<) '[ "bb", "e", "a", "e", "d" ])

Eval (Qsort (S.<) '[ "bb", "e", "a", "e", "d" ]) :: [Symbol] = '["a", "bb", "d", "e", "e"]

Instances1Eval