fin: Nat and Fin: peano naturals and finite numbers

[ bsd3, data, dependent-types, library, singletons ] [ Propose Tags ]

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

Versions [faq] 0, 0.0.1, 0.0.2, 0.0.3, 0.1
Change log ChangeLog.md
Dependencies base (>=4.7 && <4.14), bifunctors (>=5.5.3 && <5.6), dec (>=0.0.3 && <0.1), deepseq (>=1.3.0.2 && <1.5), hashable (>=1.2.7.0 && <1.4), nats (>=1.1.2 && <1.2), semigroups (>=0.18.4 && <0.20), void (>=0.7.2 && <0.8) [details]
License BSD-3-Clause
Copyright (c) 2017-2019 Oleg Grenrus
Author Oleg Grenrus <oleg.grenrus@iki.fi>
Maintainer Oleg.Grenrus <oleg.grenrus@iki.fi>
Revised Revision 1 made by phadej at Sat Sep 7 08:07:07 UTC 2019
Category Data, Dependent Types, Singletons
Home page https://github.com/phadej/vec
Bug tracker https://github.com/phadej/vec/issues
Source repo head: git clone https://github.com/phadej/vec.git
Uploaded by phadej at Sun Jul 7 11:14:28 UTC 2019
Distributions LTSHaskell:0.0.3, NixOS:0.1, Stackage:0.0.2
Downloads 1783 total (149 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2019-07-07 [all 1 reports]

Modules

[Index] [Quick Jump]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees