finite-typelits-0.2.1.0: A type inhabited by finitely many values, indexed by type-level naturals
Copyright(C) 2022-2023 mniip
LicenseBSD3
Maintainermniip <[email protected]>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
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 :: Integer -> Finite n Source #

finite :: forall (n :: Nat). 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 :: Nat). Finite n -> Integer Source #

Convert a Finite into the corresponding Integer.