This package provides two simple types, and some tools to work with them.
Also on type level as
-- Peano naturals data Nat = Z | S Nat -- Finite naturals data Fin (n :: Nat) where Z :: Fin ('S n) S :: Fin n -> Fin ('Nat.S n)
vec implements length-indexed (sized) lists using this package for indexes.
Data.Fin.Enum module let's work generically with enumerations.
See Hasochism: the pleasure and pain of dependently typed haskell programming by Sam Lindley and Conor McBride for answers to how and why. Read APLicative Programming with Naperian Functors by Jeremy Gibbons for (not so) different ones.
finite-typelits . Is a great package, but uses
type-natural depends on
finwill try to stay light on the dependencies, and support as many GHC versions as practical.
peano is very incomplete
nat as well.
PeanoWitnesses doesn't use
type-combinators is big package too.
Revision history for fin
- Explicitly derive
Son GHC-7.8 explicitly
FS. Now you can have both
Finimported unqualified in a single module.
(Enum a, Enum b) => Enum (Either a b)instance
- GHC-8.4.1 / base-4.11 support
- First version. Released on an unsuspecting world.