Trait comonoid::Comonoid [−] [src]

pub trait Comonoid {
    fn counit(self);
    fn comult(self) -> (Self, Self);
}

A comonoid in a monoidal category is a monoid in the dual category, what is the problem?

Being the dual to a monoid, it consists of:

It is useful within Rust's ownership type system, to represent a type that can be both cloned and destroyed.

There is a trivial implementation of this trait for every type that implements Clone, as reflected by the Comonoidal newtype wrapper, with discard as counit, and duplicate as comult. The behaviour of counit and comult can be altered by the implementation of Drop and Clone, respectively.

Required Methods

fn counit(self)

The dual to the monoidal unit.

fn comult(self) -> (Self, Self)

The dual to the monoidal multiplication.

Implementors