[m-dev.] feature request(2): allow `with_type` and `with_inst` in lambda terms

Ondrej Bojar bojar at csse.unimelb.edu.au
Mon Mar 5 12:45:07 AEDT 2007


This one is missing, too:

MyVar =
   (pred(A,B,C,D,E,F,G)
         `with_type` required_pred_type(foo, bar)
         `with_inst` required_pred_mode
       :- ...)

In fact, given that lambda expressions do not specify types, only the 
`with_inst` annotation is sufficient, but an extra type check might be desirable.

O.


-------- Original Message --------
Subject: [m-dev.] feature request: allow `with_type` and `with_inst` in type and 
inst definitions
Date: Mon, 05 Mar 2007 11:47:27 +1100
From: Ondrej Bojar <bojar at csse.unimelb.edu.au>
Reply-To: mercury-developers at csse.unimelb.edu.au
To: mercury-developers at csse.unimelb.edu.au

Hi,

The `with_type` and `with_inst` annotations are very useful for defining
predicates. The constructions work even if I add some extra arguments ("foreseen
currying"):

:- pred mypred(myextraarg::in)
      `with_type` folding_predicate(T)
      `with_inst` folding_predicate.

where e.g.

:- type folding_predicate(T) == pred(T, T).
:- inst folding_predicate == (pred(in, out) is det).

It would be quite useful to allow the annotations in type and inst definitions, too:

:- type extra_folding_predicate(Extra, T)
      == (pred(Extra) `with_type` folding_predicate(T)).
:- inst extra_folding_predicate
      == (pred(in) `with_inst` folding_predicate).


Thanks, Ondrej.

-- 
Ondrej Bojar (mailto:obo at cuni.cz / bojar at ufal.mff.cuni.cz)
http://www.cuni.cz/~obo
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------

-- 
Ondrej Bojar (mailto:obo at cuni.cz / bojar at ufal.mff.cuni.cz)
http://www.cuni.cz/~obo
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list