From 567af2648c0980e8bbae804cb88238d496f591a4 Mon Sep 17 00:00:00 2001 From: Markus Triska Date: Wed, 16 Oct 2019 19:13:59 +0200 Subject: [PATCH] support must_be(var, ...) --- src/prolog/lib/error.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/prolog/lib/error.pl b/src/prolog/lib/error.pl index e7b7fe66..6fb573a4 100644 --- a/src/prolog/lib/error.pl +++ b/src/prolog/lib/error.pl @@ -33,6 +33,10 @@ must_be(Type, Term) :- must_be_(Type, _) :- var(Type), instantiation_error(Type). +must_be_(var, Term) :- + ( var(Term) -> true + ; throw(error(uninstantiation_error, _)) + ). must_be_(integer, Term) :- check_(integer, integer, Term). must_be_(atom, Term) :- check_(atom, atom, Term). must_be_(list, Term) :- check_(ilist, list, Term). @@ -52,6 +56,7 @@ type(type). type(integer). type(atom). type(list). +type(var). /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - can_be(Type, Term) -- 2.54.0