Why are only top-level, argumentless functions reified in the visualizer?

Is there a particular reason why only “top-level” funs without arguments are reified in the visualizer, but not those which either have an argument or are defined on a sig?

For example, given the following spec:

sig Foo {}
sig Bar {}

fun baz: Foo -> Bar {
	Foo -> Bar
}

fun quux[f: Foo]: Bar {
	Bar
}

fun Foo.xyzzy: Bar {
	Bar
}

run {} for 2 but exactly 2 Foo, 2 Bar

Only baz will be shown in the visualizer, but not quux or xyzzy. So while I can style baz to, for example, show related Bars on a Foo, I cannot do the same with quux and xyzzy even though there is a natural interpretation of their outputs as attributes of Foo.

Is this limitation fundamental in some way? If not, it seems like an easy way to improve usability, because otherwise you are forced to declare functions as top-level relations—which is less ergonomic—just to obtain better visualisation.

quux and xyzzy are essentially the same thing here so the real difference is with baz,

I don’t think there is a particular reason other than historical. This is indeed annoying and improving the situation is on our todo list.

Indeed if the arguments are singletons it should be possible to visualize. The issue is when the arguments are sets or relations, that it is not clear to me how to do it.

1 Like