BSD-3-Clause licensed by Oleg Grenrus
Maintained by Oleg.Grenrus

Module documentation for 0.1

This version can be pinned in stack with:fin-0.1@sha256:a02c1f122f22c6c0ebf1209aff1341ada9f60492570b2f09c9812e17afacb04d,3512

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 fin

0.1

  • Rename Fin constructors to FZ and FS. Now you can have both Nat and Fin imported unqualified in a single module.

0.0.3

  • Add Data.Type.Nat.LE, Data.Type.Nat.LT and Data.Type.Nat.LE.ReflStep modules
  • Add withSNat and discreteNat

0.0.2

  • In Fin add: append and split
  • Add (Enum a, Enum b) => Enum (Either a b) instance

0.0.1

  • GHC-8.4.1 / base-4.11 support

0

  • First version. Released on an unsuspecting world.
Depends on 4 packages(full list with versions):
Used by 2 packages in nightly-2019-11-29(full list with versions):
comments powered byDisqus