From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA29537; Thu, 21 Nov 2002 22:37:37 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA29463 for ; Thu, 21 Nov 2002 22:37:36 +0100 (MET) Received: from ritchie.cas.McMaster.CA (ritchie.cas.McMaster.CA [130.113.68.10]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id gALLbYX15898 for ; Thu, 21 Nov 2002 22:37:34 +0100 (MET) Received: from schroeder.cas.mcmaster.ca (schroeder.cas.McMaster.CA [130.113.68.214]) by ritchie.cas.McMaster.CA (8.11.6+Sun/8.11.6) with SMTP id gALLbX529242 for ; Thu, 21 Nov 2002 16:37:33 -0500 (EST) Received: (qmail 17360 invoked by uid 500); 21 Nov 2002 21:45:46 -0000 Date: 21 Nov 2002 21:45:46 -0000 Message-ID: <20021121214546.17359.qmail@schroeder.cas.mcmaster.ca> From: kahl@cas.mcmaster.ca To: johan.baltie@wanadoo.fr CC: caml-list@inria.fr In-reply-to: <200211212213.14407.johan.baltie@wanadoo.fr> (message from Johan =?iso-8859-1?q?Balti=E9?= on Thu, 21 Nov 2002 22:13:14 +0100) Subject: Re: [Caml-list] Haskell class type simulation References: <200211212213.14407.johan.baltie@wanadoo.fr> Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk wrote: > > I'm currently looking for a way to simulate the Haskell "class type" notion > in OCaml i.e. the same kind of : > > class Eq a where > (==), (/=) :: a -> a -> Bool > > class (Eq a) => Ord a where > compare :: a -> a -> Ordering > (<), (<=), (>=), (>) :: a -> a -> Bool > max, min :: a -> a -> a > > For me it's a bit like module signature with an abstract type and an > "extending" semantic and a type constraint. We looked the other way in: @InProceedings{Kahl-Scheffczyk-2001, author = {Wolfram Kahl and Jan Scheffczyk}, title = {Named Instances for Haskell Type Classes}, booktitle = {Proc.\null{} Haskell Workshop 2001}, year = {2001}, editor = {Ralf Hinze}, volume = {59}, number = {2}, series = ENTCS, note = {See also: \textsf{http://ist.unibw-muenchen.de/Haskell/NamedInstances/}}, abstract = {Although the functional programming language Haskell has a powerful type class system, users frequently run into situations where they would like to be able to define or adapt instances of type classes only \emph{after} the remainder of a component has been produced. However, Haskell's type class system essentially only allows late binding of type class constraints on free type variables, and not on uses of type class members at variable-free types. In the current paper we propose a language extension that enhances the late binding capabilities of Haskell type classes, and provides more flexible means for type class instantiation. The latter is achieved via \emph{named instances} that do not participate in automatic context reduction, but can only be used for late binding. By combining this capability with the automatic aspects of the Haskell type class system, we arrive at an essentially conservative extension that greatly improves flexibility of programming using type classes and opens up new structuring principles for Haskell library design. We exemplify our extension through the sketch of some applications and show how our approach could be used to explain or subsume other language features as for example implicit parameters. We present a typed lambda-calculus for our extension and provide a working prototype type checker on the basis of Mark Jones' ``Typing Haskell in Haskell''.} } Best regards, Wolfram ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners