AlgebraicJulia / Catlab.jl

A framework for applied category theory in the Julia language
https://www.algebraicjulia.org
MIT License
608 stars 58 forks source link

`oapply` errors when called on empty wiring diagram. #802

Open samuelsonric opened 1 year ago

samuelsonric commented 1 year ago

I think that this code should create a trivial OpenGraph.

using Catlab.CategoricalAlgebra, Catlab.Programs, Catlab.Graphs, Catlab.WiringDiagrams

const _, OpenGraph = OpenCSetTypes(Graph, :V)

wd = @relation () begin
end

oapply(wd, OpenGraph[])

Instead, it throws an error:

MethodError: no method matching colimit(::Type{Tuple{Any, Any}}, ::Catlab.CategoricalAlgebra.FreeDiagrams.BasicBipartiteFreeDiagram{Any, Any})
epatters commented 1 year ago

A classic genre of bug that tends to happen when Julia fails to propagate types through maps over empty lists.