[mercury-users] Uniqueness modes etc

Dr Mark H Phillips mark at austrics.com.au
Thu Jan 8 19:05:32 AEDT 2004


On Thu, 2004-01-08 at 18:05, Zoltan Somogyi wrote:
> On 08-Jan-2004, Dr Mark H Phillips <mark at austrics.com.au> wrote:
> > I'm not sure I understand what you're saying here.  I would have 
> > thought that the generic code you outlined previously doesn't know
> > whether it's doing I/O or state transition in any case.
> 
> It does. If it is making a call with a di/uo pair of I/O states, it is
> doing I/O. If it is making a call with a di/uo pair of arguments of type
> `bits' (in Fergus's example) or of type `fstate' (in Ralph's example),
> then it is doing a state transition.

I'm obviously not getting something (bear in mind that I am very new to
mercury).  Now the type definition of generic was:

  :- pred generic(..., pred(T, T)::in(pred(di, uo) is det), T::di,
      T::uo) is det.

so in the implementation of generic, T is an arbitrary type which it can
make no assumptions about??  So it doesn't know what the di/uo pair is.
It doesn't know if it is bits, fstate or I/O states.  Or does it?  If
so, how??

You say "If it is making a call with..." but the only call it is making
which involves T, is the pred(T, T) that you will pass in.  So when you
are implementing generic you can't know more about T than that it is
some type can you??

What am I not understanding?

Thanks,

Mark.


--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list