Functor

Trait Functor 

Source
pub trait Functor<O1, A1, O2, A2> {
    // Required methods
    fn map_object(&self, o: &O1) -> impl ExactSizeIterator<Item = O2>;
    fn map_operation(
        &self,
        a: &A1,
        source: &[O1],
        target: &[O1],
    ) -> OpenHypergraph<O2, A2>;
    fn map_arrow(&self, f: &OpenHypergraph<O1, A1>) -> OpenHypergraph<O2, A2>;
}
Expand description

An easier-to-implement Functor trait for lax OpenHypergraph

Required Methods§

Source

fn map_object(&self, o: &O1) -> impl ExactSizeIterator<Item = O2>

Map a generating object of the theory

Source

fn map_operation( &self, a: &A1, source: &[O1], target: &[O1], ) -> OpenHypergraph<O2, A2>

Map a single operation of the theory with specified source and target type. This must be consistent with map_object, i.e. we must have: - F.map_operation(x, s, t).sources == F.map_object(s) - F.map_operation(x, s, t).targets == F.map_object(t) This condition is not checked, but may panic if not satisfied.

Source

fn map_arrow(&self, f: &OpenHypergraph<O1, A1>) -> OpenHypergraph<O2, A2>

Apply this functor to an OpenHypergraph. Once map_operation is defined, this can typically be defined as define_map_arrow(self, f)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<O: Clone + PartialEq, A: HasVar + Clone + PartialEq> Functor<O, A, O, A> for Forget

Source§

impl<O: PartialEq + Clone, A: Clone + PartialEq> Functor<O, A, O, A> for Identity