[mercury-users] Newbie Q on type parameters

Tom Davies tgdavies at gmail.com
Tue Aug 28 13:22:09 AEST 2007


I want to use types to reduce repetition when declaring the predicate  
parameters -- is this a sensible approach:


:- type succ_pred(T) == pred(T, T).
:- inst succ_pred == (pred(in,out) is nondet).
:- mode succ_pred_in == succ_pred >> succ_pred.

...

:- pred solve(succ_pred(T)::succ_pred_in, ...

Now my predicate of type succ_pred(node) is declared:

:- type node ---> a; b; c; d; e; f; g.
:- pred s `with_type` succ_pred(node) `with_inst` succ_pred.
s(a,b).
...

Is that the best way to do this?

Tom

--------------------------------------------------------------------------
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