Skip to content

Can't use empty type in models #182

@kris-brown

Description

@kris-brown

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions