fin: Nat and Fin: peano naturals and finite numbers

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

This package provides two simple types, and some tools to work with them. Also on type level as `DataKinds`.

```-- 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.

The 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.

Similar packages

• finite-typelits . Is a great package, but uses `GHC.TypeLits`.

• type-natural depends on `singletons` package. `fin` will 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 `DataKinds`.

• type-combinators is big package too.

Properties

Versions 0, 0.0.1, 0.0.2, 0.0.3, 0.1, 0.1.1, 0.2, 0.2, 0.2.1, 0.3 ChangeLog.md base (>=4.7 && <4.16), bifunctors (>=5.5.3 && <5.6), dec (>=0.0.4 && <0.1), deepseq (>=1.3.0.2 && <1.5), hashable (>=1.2.7.0 && <1.4), nats (>=1.1.2 && <1.2), QuickCheck (>=2.13.2 && <2.15), semigroups (>=0.18.5 && <0.20), universe-base (>=1.1.2 && <1.2), void (>=0.7.3 && <0.8) [details] BSD-3-Clause (c) 2017-2021 Oleg Grenrus Oleg Grenrus Oleg.Grenrus Data, Dependent Types, Singletons, Math https://github.com/phadej/vec https://github.com/phadej/vec/issues head: git clone https://github.com/phadej/vec.git(fin) by phadej at 2021-02-28T10:02:13Z

Modules

[Index] [Quick Jump]

• Data