Wolfgang Lux wrote:
> > as already done in the Muenster Curry Compiler.
> > However, I'll keep the definition of (==) as a primitive
> > (like in the MCC) since its direct implementation is a bit
> > more efficient than compare and it is often used in programs.
>
> There is a more important reason for using two different
> primitives for equality and ordering: For some types it is
> possible to check equality, but they do not have a natural
> ordering. For instance, MCC supports equality tests for
> partial applications (which seems natural given that they
> can be used in equality and disequality constraints), file
> handles, and also mutable references in the IO monad. However,
> compare will report an error at runtime when applied to
> arguments of these kinds.
This is a good point. However, instead of a runtime error,
one could also simply fail which expresses the view that "compare"
could be applied to any expression but is only defined as a total
order in ground data terms.
Best regards,
Michael
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Di Mär 21 2006 - 12:34:24 CET