Re: Curry Report Vers. 0.8.2

From: Michael Hanus <mh_at_informatik.uni-kiel.de>
Date: Mon, 20 Mar 2006 12:20:57 +0100

Sebastian Fischer wrote:
> Michael Hanus wrote:
> We could define (==), (<), (<=), (>) and (>=) in terms of compare.
> After that e.g. the functions List.leqList, List.leq.Char and
> List.leqString could all be defined as (<=). Or is there a reason to
> provide a compare function for arbitrary datatypes and restrict
> compare predicates to Int?

No, I don't think there is a good reason.

Thus, I'll define the comparison functions
(<), (<=), (>) and (>=) in terms of compare in the prelude
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.
Furthermore, in terms of this discussion, I think it makes
also sense to define min/max in the prelude by

max :: a -> a -> a
max x y = if x >= y then x else y

min :: a -> a -> a
min x y = if x <= y then x else y

Best regards,

Michael

_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Mo Mär 20 2006 - 12:44:19 CET

This archive was generated by hypermail 2.3.0 : Do Jun 20 2024 - 07:15:08 CEST