6.12.3.1.3. Monoids

A monoid is a category with one object.
Start python section to interscript/felix/model/stdcat.py[4 /10 ] Next Prev Last
    15: #line 24 "felix_stdcat.ipk"
    16: 
    17: class cat_monoid(category):
    18:   def __init__(self, unit): self.unit = unit
    19: 
    20:   def can_compose(self, left, right): return 1
    21: 
    22:   def domain(self, arrow): return self.unit
    23:   def codomain(self, arrow): return self.unit
    24:   def get_unit(self): return self.unit
    25: 
    26:   def __call__(self, *args):
    27:     return reduce(self.compose, args, self.get_unit())
    28: 
    29:   def is_object(self, object): return object == self.unit
    30: 
End python section to interscript/felix/model/stdcat.py[4]