AlgebraicJulia / AlgebraicJulia/GATlab.jl

Can't use empty type in models

Open
#182 0 comments 0 reactions 0 assignees View on GitHub
wontfix
Dominant language
Julia
Stars
43
Forks
4
PR merge metrics
No merged PRs in 30d

Description

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](https://github.com/JuliaLang/julia/issues/52385) 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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.