type-combinators-0.1.2.1: 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

(~) 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 

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.

class x <= y where Source

Methods

weakenN :: Fin x -> Fin y Source

Instances

x <= x Source 
(<=) x y => x <= (S y) Source 

finNat :: Fin x -> Some Nat Source

Take a Fin to an existentially quantified Nat.