finite-typelits-0.2.0.0: A type inhabited by finitely many values, indexed by type-level naturals
Copyright(C) 2022-2023 mniip
LicenseBSD3
Maintainermniip <mniip@mniip.com>
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Finite.Internal

Description

 
Synopsis

Documentation

type Finite = Finite Integer Source #

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

getFinite x < natVal x
getFinite x >= 0

pattern Finite :: forall n. Integer -> Finite n Source #

finite :: forall n. KnownNat n => Integer -> Finite n Source #

Convert an Integer into a Finite, throwing an error if the input is out of bounds.

getFinite :: forall n. Finite n -> Integer Source #

Convert a Finite into the corresponding Integer.