@@ -25,6 +25,58 @@ class HomsetsCategory(FunctorialConstructionCategory):
25
25
@classmethod
26
26
@cached_function
27
27
def category_of (cls , category , * args ):
28
+ """
29
+ Return the homsets category of ``category``.
30
+
31
+ This class method centralizes the construction of all homset
32
+ categories.
33
+
34
+ The ``cls`` and ``args`` arguments below are essentially
35
+ unused. Their purpose is solely to let the code deviate as
36
+ little as possible from the generic implementation of this
37
+ method: :meth:`FunctorialConstructionCategory.category_of`.
38
+
39
+ INPUT:
40
+
41
+ - ``cls`` -- :class:`HomsetsCategory` or a subclass thereof
42
+ - ``category`` -- a category `Cat`
43
+ - ``*args`` -- (unused)
44
+
45
+ EXAMPLES:
46
+
47
+ If ``category`` implements a ``Homsets`` class, then this
48
+ class is used to build the homset category::
49
+
50
+ sage: from sage.categories.homsets import HomsetsCategory
51
+ sage: H = HomsetsCategory.category_of(Modules(ZZ)); H
52
+ Category of homsets of modules over Integer Ring
53
+ sage: type(H)
54
+ <class 'sage.categories.modules.Modules.Homsets_with_category'>
55
+
56
+ Otherwise, if ``category`` has one or more full super
57
+ categories, then the join of their respecitve homsets category
58
+ is returned. In this example, the join is trivial::
59
+
60
+ sage: C = Modules(ZZ).WithBasis().FiniteDimensional()
61
+ sage: C.full_super_categories()
62
+ [Category of modules with basis over Integer Ring,
63
+ Category of finite dimensional modules over Integer Ring]
64
+ sage: H = HomsetsCategory.category_of(C); H
65
+ Category of homsets of modules with basis over Integer Ring
66
+ sage: type(H)
67
+ <class 'sage.categories.modules_with_basis.ModulesWithBasis.Homsets_with_category'>
68
+
69
+ As a last resort, a :class:`HomsetsOf` of categories forming
70
+ the structure of ``self`` is constructed::
71
+
72
+ sage: H = HomsetsCategory.category_of(Magmas()); H
73
+ Category of homsets of magmas
74
+ sage: type(H)
75
+ <class 'sage.categories.homsets.HomsetsOf_with_category'>
76
+
77
+ sage: HomsetsCategory.category_of(Rings())
78
+ Category of homsets of unital magmas and additive unital additive magmas
79
+ """
28
80
functor_category = getattr (category .__class__ , cls ._functor_category )
29
81
if isinstance (functor_category , type ) and issubclass (functor_category , Category ):
30
82
return functor_category (category , * args )
@@ -251,7 +303,7 @@ def extra_super_categories(self):
251
303
EXAMPLES::
252
304
253
305
sage: from sage.categories.homsets import Homsets
254
- sage: Homsets().Endsets ().extra_super_categories()
306
+ sage: Homsets().Endset ().extra_super_categories()
255
307
[Category of monoids]
256
308
"""
257
309
from monoids import Monoids
0 commit comments