To retain some of the flexility of Prolog we have
union (aka
disjunctive) types. For example, using the union type:
def int_atom ::= integer || atom
we can specify that a relation
r accepts either integers or atoms in some input argument position. We can then use the runtime type test primitive to determine which type of value has been given in the call. Typically we would have two rules for
r(int_atom,...), one with the test
type(A1,int) and the other with the test
type(A1,atom), where
A1 is the variable in the first argument position of the rule head. In
QuLog run-time type tests can be done for any primitive type, any program defined type, as well as any higher order type.