You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Interoperability between the old style of GATlab and the new one has been limited to creating models. One can create an old-style one (where implementation is just dictated by dispatch) by not providing a [model::MyModel] in the @instance declaration.
However, if one is consuming models, such as a function f(some_ThCategory_model, some_ThMonoid_model) then this can really only ever use the new GATlab models, since there's no reified thing to plug in which says "just use type dispatch".
However, GATlab could define a struct Dispatch end along with
Base.getindex(f, ::Dispatch) = f
So that compose[myDispatchModel](f::GATExpr, g::GATExpr) would just evaluate to whatever type dispatch says compose(f::GATExpr, g::GATExpr) should do. This is relevant to Catlab, where we want to use infrastructure which expects explicit models on the result of @symbolic_model, which currently just produces an old-style instance.
For a related and slightly different problem: consider that one might have a model (e.g. struct CatC which implements ThCategory with Category and Functor), and it's already the case that ThCategory.dom(::Functor), ThCategory.id(::Category), etc. are all defined. Here it would be convenient to have a macro which says "CatC should just use dispatch to implement ThCategory" rather than writing out a bunch of boilerplate. It could look like this:
Interoperability between the old style of GATlab and the new one has been limited to creating models. One can create an old-style one (where implementation is just dictated by dispatch) by not providing a
[model::MyModel]
in the@instance
declaration.However, if one is consuming models, such as a function
f(some_ThCategory_model, some_ThMonoid_model)
then this can really only ever use the new GATlab models, since there's no reified thing to plug in which says "just use type dispatch".However, GATlab could define a
struct Dispatch end
along withSo that
compose[myDispatchModel](f::GATExpr, g::GATExpr)
would just evaluate to whatever type dispatch sayscompose(f::GATExpr, g::GATExpr)
should do. This is relevant to Catlab, where we want to use infrastructure which expects explicit models on the result of@symbolic_model
, which currently just produces an old-style instance.For a related and slightly different problem: consider that one might have a model (e.g.
struct CatC
which implementsThCategory
withCategory
andFunctor
), and it's already the case thatThCategory.dom(::Functor)
,ThCategory.id(::Category)
, etc. are all defined. Here it would be convenient to have a macro which says "CatC
should just use dispatch to implementThCategory
" rather than writing out a bunch of boilerplate. It could look like this:No: maybe
CatC
implements some other theories (e.g.Th2Category
) in different ways that will not be implemented by mere dispatch.The text was updated successfully, but these errors were encountered: