:- ensure_loaded('../typeops').

% example for a predicate t with an element or a list of element as argument
% problem: it is not so easy to find a right typing 

:- import(prolog_types).
:- import_pred(prolog_meta, '!'/0).
:- import_pred(prolog_meta, var/1).
:- import_pred(prolog_meta, fail/0).
:- import_pred(prolog_meta, '='/2).

:- type element(T) --> {X | (atom(X), T = atom)}.

:- type list_or_element(T).
:- type list_or_element(T) > element(T).
:- type list_or_element(T) > list(T).

:- pred t(list_or_element(T)).

t(_).

?- t(a).
?- t([a, b, c]).

?- A = a, t(A).
?- A = [a, b, c], t(A).
