:- module test. :- interface. :- typeclass foo(A) where []. :- type baz ---> x; y. :- some [T] func f(baz) = T => foo(T). :- implementation. :- type bar ---> a; b. :- instance foo(bar) where []. f(x) = a. f(y) = b. %f(A) = B :- A = x, B = a; A = y, B = b.