Not until you pointed it out. What I am looking for is somthing that
will return true for:

DirectedGraph(String)
FunctionGraph(String)
DirectedGraph(NNI)
FunctionGraph(DoubleFloat)
DirectedGraph(DirectedGraph(String))
... and so on

that is any domain of the form

x(y)

where x is an instance of FiniteGraph
and y is an instance of SetCategory

Well, look at your definition. You have

FiniteGraph(S): Category == Definition where
 S: SetCategory

https://github.com/hemmecke/fricas-svn/blob/master/src/algebra/graph.spad.pamphlet#L842

and

DirectedGraph(S): Exports == Implementation where
 S: SetCategory
 ...
 Exports ==> FiniteGraph(S) with
 ...

https://github.com/hemmecke/fricas-svn/blob/master/src/algebra/graph.spad.pamphlet#L1807

The y has to be of type SetCategory in any case. I the compiler accepts something that is not of type SetCategory when x=FiniteGraph or x=DirectedGraph, then that's a bug in the compiler.

What you basically want is to ignore what the argument type is. I've no idea whether that is appropriate, but since you want it...

You could create a dummy category that simply encodes the fact that the domain is "a FiniteGraph over something". You can do this in the following way.
Similar to this...
https://github.com/hemmecke/fricas-svn/blob/master/src/algebra/attribs.spad.pamphlet

FiniteGraphCategory: Category == with ()

FiniteGraph(S: SetCategory): Category == Join(FiniteGraphCategory, ...)

And... you guessed it ... you then ask

if X has FiniteGraphCategory then ...

Well, of course you can cheat, i.e. give the FiniteGraphCategory to a domain that does not really inherit from FiniteGraph(S). You have to follow a convention and discipline.

I hope that helps for this particular case. The general case is unfortunately impossible.

Ralf

--
You received this message because you are subscribed to the Google Groups "FriCAS - 
computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.

Reply via email to