Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn about unsupported operations in DummyCategory and support "list_of_lists_of_morphisms" in CategoryConstructor #1415

Merged
merged 3 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CAP/PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SetPackageInfo( rec(

PackageName := "CAP",
Subtitle := "Categories, Algorithms, Programming",
Version := "2023.08-08",
Version := "2023.08-09",
Date := (function ( ) if IsBound( GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE ) then return GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE; else return Concatenation( ~.Version{[ 1 .. 4 ]}, "-", ~.Version{[ 6, 7 ]}, "-01" ); fi; end)( ),
License := "GPL-2.0-or-later",

Expand Down
6 changes: 5 additions & 1 deletion CAP/gap/CategoryConstructor.gi
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ InstallMethod( CategoryConstructor,
info := CAP_INTERNAL_METHOD_NAME_RECORD.(name);

# check if filters and return_type are known
unknown_filters := Filtered( info.filter_list, filter -> not filter in [ "category", "object", "morphism", "integer", "element_of_commutative_ring_of_linear_structure", "nonneg_integer_or_infinity", "list_of_objects", "list_of_morphisms", "pair_of_morphisms", "list_of_integers_and_list_of_morphisms" ] );
unknown_filters := Filtered( info.filter_list, filter -> not filter in [ "category", "object", "morphism", "integer", "element_of_commutative_ring_of_linear_structure", "nonneg_integer_or_infinity", "list_of_objects", "list_of_morphisms", "list_of_lists_of_morphisms", "pair_of_morphisms", "list_of_integers_and_list_of_morphisms" ] );

if not IsEmpty( unknown_filters ) then

Expand Down Expand Up @@ -383,6 +383,10 @@ InstallMethod( CategoryConstructor,

return Concatenation( "List( ", argument_name, ", x -> ", options.underlying_morphism_getter_string, "( cat, x ) )" );

elif filter = "list_of_lists_of_morphisms" then

return Concatenation( "List( ", argument_name, ", x -> List( x, y -> ", options.underlying_morphism_getter_string, "( cat, y ) ) )" );

elif filter = "pair_of_morphisms" then

return Concatenation( "Pair( ", options.underlying_morphism_getter_string, "( cat, ", argument_name, "[1] ), ", options.underlying_morphism_getter_string, "( cat, ", argument_name, "[2] ) )" );
Expand Down
12 changes: 11 additions & 1 deletion CAP/gap/DummyCategory.gi
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[ IsRecord ],

function( options )
local category_constructor_options, dummy_function, C;
local category_constructor_options, dummy_function, C, operation_name;

category_constructor_options := ShallowCopy( options );
category_constructor_options.category_filter := IsDummyCategory;
Expand Down Expand Up @@ -77,6 +77,16 @@

Finalize( C );

for operation_name in options.list_of_operations_to_install do

if not CanCompute( C, operation_name ) then

Print( "WARNING: The dummy category cannot compute ", operation_name, ", probably because the operation is not supported by CategoryConstructor yet.\n" );

Check warning on line 84 in CAP/gap/DummyCategory.gi

View check run for this annotation

Codecov / codecov/patch

CAP/gap/DummyCategory.gi#L84

Added line #L84 was not covered by tests
zickgraf marked this conversation as resolved.
Show resolved Hide resolved

fi;

od;

return C;

end );