fin

Nat and Fin: peano naturals and finite numbers

https://github.com/phadej/vec

Version on this page:0.0.1@rev:1
LTS Haskell 22.14:0.3@rev:2
Stackage Nightly 2024-03-28:0.3@rev:2
Latest on Hackage:0.3@rev:2

See all snapshots fin appears in

BSD-3-Clause licensed by Oleg Grenrus
Maintained by Oleg.Grenrus
This version can be pinned in stack with:fin-0.0.1@sha256:a16d51beda2436dccc3ec7356c4e8d8197a6ca1fea642cd42cbb07199c10cd14,3530

Module documentation for 0.0.1

Depends on 3 packages(full list with versions):
Used by 2 packages in nightly-2019-02-24(full list with versions):

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

Changes

Revision history for boring

0.0.1

  • GHC-8.4.1 / base-4.11 support

0

  • First version. Released on an unsuspecting world.