Monoid

com.phasmidsoftware.visitor.core.Monoid
trait Monoid[A]

Typeclass: an associative binary operation with an identity element.

Extends Zero with combine. Mirrors the Cats Monoid typeclass but without the Cats dependency.

Primary use in Visitor/Gryphon:

  • Dijkstra needs both identity (seed cost) and combine (path cost accumulation).
  • Prim needs only identity — use Zero[E] for Prim, Monoid[E] for Dijkstra.

Type parameters

A

the element type

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def combine(x: A, y: A): A

An associative binary operation.

An associative binary operation.

Attributes

def identity: A

The identity element: combine(identity, x) == x for all x.

The identity element: combine(identity, x) == x for all x.

Attributes