cp_library_rs/algebraic_structure/
to_acted.rs1use crate::algebraic_structure::{actedmonoid::ActedMonoid, monoid::Monoid};
4
5pub struct ToActed<M>(M)
7where
8 M: Monoid,
9 M::Val: PartialEq;
10
11impl<M> ActedMonoid for ToActed<M>
12where
13 M: Monoid,
14 M::Val: PartialEq,
15{
16 type Val = M::Val;
17 type Act = ();
18 fn e() -> Self::Val {
19 M::e()
20 }
21 fn id() -> Self::Act {}
22 fn op(x: &Self::Val, y: &Self::Val) -> Self::Val {
23 M::op(x, y)
24 }
25 fn compose(_: &Self::Act, _: &Self::Act) -> Self::Act {}
26 fn mapping(x: &Self::Val, _: &Self::Act) -> Self::Val {
27 x.clone()
28 }
29}