Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a big refactor - right now just a draft. The goal is to rely less on type dispatch and use explicit models from GATlab. This will ultimately address a number of persistent problems we've seen in Catlab over the years, including issues with empty lists and VarSets vs FinSets. It will still be convenient at times to use a Julia
abstract_type
to handle informal interfaces, but for things like different implementations of FinSets, different implementations of FinCats, etc. we will use a data structure with aimpl
field and amodel
field which controls how the implementation satisfies the desired interface.It is a bit difficult to track the changes because this is also an appropriate time to restructure the files. I'll do my best to summarize them here (eventually). One idea I have is that the
CategoricalAlgebra
code that is category-agnostic could come first, and then subfolders related to Set-like categories and C-Set-like categories could come afterwards.The goal is for only minor breaking changes, keeping the user-experience as unchanged as possible despite big changes under the hood.
The current status is that that (Fin)Sets/(Fin)Functions/FreeDiagrams/Limits have all been refactored to rely less on type dispatch. Next is FinCats, and after that it remains to be seen how much change the CSet code requires.
Changes:
Set
's element type should not be part of theFinSet
(orSetOb
) Julia type.TypeCat
is a "Pair of Julia types regarded as a category. The Julia types should form an@instance
of the theory of categories". This should be replaced with simply a model ofThCategory
. BecauseTypeCat
was the only subtype ofCategory{Ob,Hom}
,Category{Ob,Hom}
is now just a wrapper around aModel{Tuple{Ob,Hom}}
that implementsThCategory
.is_hom_equal
(not part of the ThCategory, doesn't get used anywhere in Catlab)ob(::Cat{Ob,Hom}, x)
andhom
coercions cannot be handled by dispatch if we are now allowing for multiple different categories with the sameOb
andHom
.