HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Modulefinite-typelits-0.2.1.0Haskell2010

Data.Finite

  • 1 type
  • 38 values
typetype Finite = Finite Integer
#

Finite number type. The type Finite n is inhabited by exactly n values in the range [0, n) including 0 but excluding n. Invariants:

Property
getFinite x < natVal x
Property
getFinite x >= 0
valueshift :: Finite n -> Finite (n + 1)
#

Add one inhabitant in the beginning, shifting everything up by one.

valueunshift :: Finite (n + 1) -> Maybe (Finite n)
#

Remove one inhabitant from the beginning, shifting everything down by one. Returns Nothing if the input was the removed inhabitant.

valueunshiftN :: (KnownNat n, KnownNat m) => Finite n -> Maybe (Finite m)
#

Remove multiple inhabitants from the beginning, shifting everything down by the amount of inhabitants removed. Returns Nothing if the input was one of the removed inhabitants.