type-combinators-0.2.0.0: A collection of data types for type-level programming

CopyrightCopyright (C) 2015 Kyle Carter
LicenseBSD3
MaintainerKyle Carter <kylcarte@indiana.edu>
Stabilityexperimental
PortabilityRankNTypes
Safe HaskellNone
LanguageHaskell2010

Data.Type.Fin

Description

A singleton-esque type for representing members of finite sets.

Synopsis

Documentation

data Fin :: N -> * where Source

Constructors

FZ :: Fin (S n) 
FS :: !(Fin n) -> Fin (S n) 

Instances

Read1 N Fin Source 
Show1 N Fin Source 
Ord1 N Fin Source 
Eq1 N Fin Source 
(~) N n' (Pred n) => Witness ØC ((~) N (S n') n) (Fin n) Source

A Fin n is a Witness that n >= 1.

That is, Pred n is well defined.

Eq (Fin n) Source 
Ord (Fin n) Source 
Show (Fin n) Source 
type WitnessC ØC ((~) N (S n') n) (Fin n) = (~) N n' (Pred n) Source 

elimFin :: (forall x. p (S x)) -> (forall x. Fin x -> p x -> p (S x)) -> Fin n -> p n Source

fins :: Nat n -> [Fin n] Source

Gives the list of all members of the finite set of size n.

fin :: Fin n -> Int Source

finZ :: Fin Z -> Void Source

There are no members of Fin Z.

weaken :: Fin n -> Fin (S n) Source

without :: Fin n -> Fin n -> Maybe (Fin (Pred n)) Source

Map a finite set to a lower finite set without one of its members.

finNat :: Fin x -> Some Nat Source

Take a Fin to an existentially quantified Nat.