:- module switch_scope. :- interface. :- import_module bool. :- import_module pair. :- type index ---> first ; second. :- pred clear(index::in, pair(bool)::in, pair(bool)::out) is semidet. :- implementation. clear(I, P0, P) :- require_complete_switch [Index] ( I = first, P0 = yes - Y, P = no - Y ; I = second, P0 = X - yes, P = X - no ).