<div>Imagine a Bloom filter module with this interface:</div><div><br></div><div><div>    :- type filter(T).</div><div>    :- func init = filter(T).</div><div>    :- func from_list(list(T)) = filter(T) <= hashable(T).</div>
<div>    :- func insert(T, filter(T)) = filter(T) <= hashable(T).</div><div>    :- pred member(T::in, filter(T)::in) is semidet <= hashable(T).</div></div><div><br></div><div>Each function and predicate declares the hashable(T) constraint.  Is there a way to factor out that constraint so that it's declared once on the type?</div>
<div><br></div><div>I found nothing in the documentation. I tried several variants with existential types, but had no success.  I'd love this to work:</div><div><br></div><div>    :- type filter(T) <= hashable(T).</div>
<div><div>    :- func init = filter(T).</div><div>    :- func from_list(list(T)) = filter(T).</div><div>    :- func insert(T, filter(T)) = filter(T).</div><div>    :- pred member(T::in, filter(T)::in) is semidet.</div></div>
<div><br></div><div>Is there a way to do this with existential types?</div><div><br></div><div>-- </div>Michael<br>