/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
I place this code in the public domain. Use it in any way you want.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
must_be_(type, Term) :- check_(error:type, type, Term).
must_be_(boolean, Term) :- check_(error:boolean, boolean, Term).
must_be_(term, Term) :-
- ( \+ ground(Term) ->
- instantiation_error(must_be/2)
- ; \+ acyclic_term(Term) ->
- type_error(term, Term, must_be/2)
- ; true
+ ( acyclic_term(Term) ->
+ ( ground(Term) -> true
+ ; instantiation_error(must_be/2)
+ )
+ ; type_error(term, Term, must_be/2)
).
% We cannot use maplist(must_be(character), Cs), because library(lists)