HORIZON HASKELLDocslts/ghc-9.14.x7a6c33e2026-10-12Search packagesCtrl K
Theme: |

GHC 9.14.1 · lts/ghc-9.14.x · 7a6c33e · 2026-10-12

Modulevortex-journal-0.1.0GHC2024

Vortex.Journal.Marking

A marking: a finite multiset of resource tokens. Markings are the linear part of a journal: a token is never copied or dropped, only consumed by one operation and produced by another, so the multiset operations here are the whole of the arithmetic a state is allowed.

Synopsis
newtypenewtype Marking tok

A multiset of tokens. The invariant, kept by every function here, is that no token is held with a count of zero, so two markings with the same tokens are equal as values.

Instances5Eq, Ord, Show, Semigroup, Monoid
  • Eq tok => Eq (Marking tok)Defined in vortex-journal-0.1.0 · Vortex.Journal.Marking
  • Ord tok => Ord (Marking tok)Defined in vortex-journal-0.1.0 · Vortex.Journal.Marking
  • Show tok => Show (Marking tok)Defined in vortex-journal-0.1.0 · Vortex.Journal.Marking
  • Ord tok => Semigroup (Marking tok)Defined in vortex-journal-0.1.0 · Vortex.Journal.Marking
  • Ord tok => Monoid (Marking tok)Defined in vortex-journal-0.1.0 · Vortex.Journal.Marking
valueminus :: Ord tok => Marking tok -> Marking tok -> Marking tok

Multiset difference, truncated at zero. Where contains m n holds it is exact: plus (minus m n) n == m.

valuebind :: Ord tok' => (tok -> Marking tok') -> Marking tok -> Marking tok'

The monoid homomorphism a map on tokens extends to: each token is replaced by its image, counts multiplying. Markings are the free commutative monoid on tokens, so every homomorphism is one of these.