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

Can't use empty type in models #182

Open
kris-brown opened this issue Dec 11, 2024 · 0 comments
Open

Can't use empty type in models #182

kris-brown opened this issue Dec 11, 2024 · 0 comments
Labels
wontfix This will not be worked on

Comments

@kris-brown
Copy link
Collaborator

kris-brown commented Dec 11, 2024

The bottom type Union{} has some nice properties. For example, a DiscreteCategory{Ob} could be a model of ThCategory{Ob, Union{}}. However, GATlab tries to instantiate the method id(x::Union{}) = ... and the Julia compiler rejects this due to a breaking change in Julia 1.10 that has persisted in 1.11. In Julia 1.12 it might be addressed.

So this issue is just documenting an upstream problem rather than anything to be done in GATlab itself.

In practice, this just leads to definitions like DiscreteCategory{Ob, Hom} - we have to manually declare what the homs would be when creating a discrete category, which is cumbersome. Another solution is that we can use a type parameter: @instance ThCategory{Ob, T} where {T<:Union{}} (the compiler does not reject f(x::T) where {T<:Union{}}), though this results in a bunch of "T was declared but not used" warnings.

@kris-brown kris-brown added the wontfix This will not be worked on label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant