[mercury-users] typeclass constraints on types
Julien Fischer
juliensf at csse.unimelb.edu.au
Thu May 31 13:34:11 AEST 2012
On Wed, 30 May 2012, Michael Hendricks wrote:
> Imagine a Bloom filter module with this interface:
>
> :- type filter(T).
> :- func init = filter(T).
> :- func from_list(list(T)) = filter(T) <= hashable(T).
> :- func insert(T, filter(T)) = filter(T) <= hashable(T).
> :- pred member(T::in, filter(T)::in) is semidet <= hashable(T).
>
> 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?
No, not in Mercury as it is currently defined.
Julien.
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to: mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions: mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the users
mailing list