HORIZON HASKELLDocslts/ghc-10.0.x2b276322026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 2b27632 · 2026-10-31

Modulevortex-journal-0.1.2GHC2024

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.2 · Vortex.Journal.Marking
  • Ord tok => Ord (Marking tok)Defined in vortex-journal-0.1.2 · Vortex.Journal.Marking
  • Show tok => Show (Marking tok)Defined in vortex-journal-0.1.2 · Vortex.Journal.Marking
  • Ord tok => Semigroup (Marking tok)Defined in vortex-journal-0.1.2 · Vortex.Journal.Marking
  • Ord tok => Monoid (Marking tok)Defined in vortex-journal-0.1.2 · 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.