Skip to content

Commit

Permalink
Fixing a badly handled tight typing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Arlin committed Sep 22, 2023
1 parent 9212cbc commit bc49605
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[deps.Catlab]]
deps = ["ACSets", "Colors", "CompTime", "Compose", "DataStructures", "GeneralizedGenerated", "JSON", "LightXML", "LinearAlgebra", "Logging", "MLStyle", "PrettyTables", "Random", "Reexport", "SparseArrays", "StaticArrays", "Statistics", "StructEquality", "Tables"]
git-tree-sha1 = "45594ceb9241cc635afbdd6e67c9a2a839f3342b"
repo-rev = "removeMigrations"
repo-url = "https://github.com/AlgebraicJulia/Catlab.jl/"
git-tree-sha1 = "8708b14c8548ca6a06c06ba41db3c542b83b3e2c"
repo-rev = "unbreakMakemap"
repo-url = "https://github.com/AlgebraicJulia/Catlab.jl"
uuid = "134e5e36-593f-5add-ad60-77f754baafbe"
version = "0.15.5"

Expand Down
4 changes: 2 additions & 2 deletions src/DiagrammaticPrograms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ function parse_diagram_data(C::FinCat, statements::Vector{<:AST.DiagramExpr};
type=Any, ob_parser=nothing, hom_parser=nothing)
isnothing(ob_parser) && (ob_parser = x -> parse_ob(C, x))
isnothing(hom_parser) && (hom_parser = (f,x,y) -> parse_hom(C,f))
g, eqs = Presentation(FreeCategory), Pair[]
g, eqs = Presentation(FreeSchema), Pair[]
F_ob, F_hom, params = Dict{GATExpr,Any}(), Dict{GATExpr,Any}(), Dict{Symbol,Union{Literal,Function}}()
mornames = map(nameof,hom_generators(C))
for stmt in statements
Expand Down Expand Up @@ -522,7 +522,7 @@ function parse_diagram_data(C::FinCat, statements::Vector{<:AST.DiagramExpr};
_ => error("Cannot use statement $stmt in diagram definition")
end
end
J = FinCat(g)
J = FinCat(g) #oh no!
DiagramData{type}(F_ob,
F_hom, J, params)
end
Expand Down
12 changes: 9 additions & 3 deletions src/Migrations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import Catlab.Theories: compose
using Catlab.Graphs.BasicGraphs: vertex_named
import Catlab.CategoricalAlgebra.Categories: ob_map, hom_map
import Catlab.GATs: functor
using Catlab.CategoricalAlgebra.FinCats: make_map, mapvals, presentation_key, FinCatPresentation
using Catlab.CategoricalAlgebra.FinCats: make_map, mapvals, presentation_key, FinCatPresentation, FinDomFunctorMap
import Catlab.CategoricalAlgebra.FinCats: force
using Catlab.CategoricalAlgebra.Chase: collage, crel_type, pres_to_eds, add_srctgt, chase
using Catlab.CategoricalAlgebra.FinSets: VarSet
using Catlab.CategoricalAlgebra.Sets: SetFunctionCallable
import Catlab.CategoricalAlgebra.FunctorialDataMigrations: migrate, migrate!, AbstractDataMigration, ContravariantMigration, DeltaSchemaMigration
import Catlab.CategoricalAlgebra.Diagrams: DiagramHom
using MLStyle: @match
Expand Down Expand Up @@ -375,16 +376,21 @@ function migrate(X::FinDomFunctor, M::ConjSchemaMigration;
Fc = ob_map(F, c)
J = shape(Fc)
# Must supply object/morphism types to handle case of empty diagram.
diagram_types = if c isa AttrTypeExpr
#=
diagram_types = if c isa AttrTypeExpr #Note this won't work if M constructed its own target schema!!!
(TypeSet, SetFunction)
elseif is_discrete(J)
elseif isempty(J)
(FinSet{Int}, FinFunction{Int})
else
(SetOb, FinDomFunction{Int})
end
=#
diagram_types = isempty(J) ? (FinSet{Int}, FinFunction{Int}) : (Any,Any)
# Make sure the diagram to be limited is a FinCat{<:Int}.
# Disable domain check because acsets don't store schema equations.
k = dom_to_graph(diagram(force(compose(Fc, X, strict=false), diagram_types...)))
#cover for the annoying fact that FinDomFunctions containing a lambda are SetFunctionCallables but FinDomFunctionMaps are not.
if valtype(k.hom_map) <: SetFunctionCallable k = FinDomFunctorMap(k.ob_map,FinDomFunction{Int}[a for a in k.hom_map],k.dom,TypeCat(SetOb,FinDomFunction{Int})) end
lim = limit(k, SpecializeLimit(fallback=ToBipartiteLimit()))
if tabular
names = (ob_generator_name(J, j) for j in ob_generators(J))
Expand Down
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[deps]
Catlab = "134e5e36-593f-5add-ad60-77f754baafbe"
DataMigrations = "0c4ad18d-0c49-4bc2-90d5-5bca8f00d6ae"
Debugger = "31a5f54b-26ea-5ae9-a837-f05ce5417438"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

0 comments on commit bc49605

Please sign in to comment.