covenant
Copyright(C) MLabs 2025
LicenseApache 2.0
Maintainerkoz@mlabs.city, sean@mlabs.city
Safe HaskellNone
LanguageHaskell2010

Covenant.DeBruijn

Description

DeBruijn indexing type and helpers. These are mainly used for scope tracking.

Synopsis

Documentation

data DeBruijn where Source #

A DeBruijn index.

Since: 1.0.0

Bundled Patterns

pattern Z :: DeBruijn

The zero index.

Since: 1.0.0

pattern S :: DeBruijn -> DeBruijn

Successor to an index.

Since: 1.0.0

Instances

Instances details
Arbitrary DeBruijn Source #

Since: 1.0.0

Instance details

Defined in Covenant.DeBruijn

Monoid DeBruijn Source #

Since: 1.0.0

Instance details

Defined in Covenant.DeBruijn

Semigroup DeBruijn Source #

Enables some manner of arithmetic with DeBruijns. In this case, <> is analogous to +, while stimes b is analogous to scalar multiplication by b. Note that DeBruijns cannot be scaled by negative numbers.

Since: 1.0.0

Instance details

Defined in Covenant.DeBruijn

Show DeBruijn Source #

Since: 1.0.0

Instance details

Defined in Covenant.DeBruijn

Eq DeBruijn Source #

Since: 1.0.0

Instance details

Defined in Covenant.DeBruijn

Ord DeBruijn Source #

Since: 1.0.0

Instance details

Defined in Covenant.DeBruijn

asInt :: DeBruijn -> Int Source #

Convert a DeBruijn index into a (non-negative) Int.

Since: 1.0.0