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 NAA14922; Sat, 22 Sep 2001 13:46:05 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA14918 for ; Sat, 22 Sep 2001 13:46:04 +0200 (MET DST) Received: from mta05-svc.ntlworld.com (mta05-svc.ntlworld.com [62.253.162.45]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f8MBk3D26703 for ; Sat, 22 Sep 2001 13:46:04 +0200 (MET DST) Received: from comcal.murdomedia.net ([62.253.8.8]) by mta05-svc.ntlworld.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20010922114603.OVA20588.mta05-svc.ntlworld.com@comcal.murdomedia.net> for ; Sat, 22 Sep 2001 12:46:03 +0100 Message-Id: <4.3.2.7.2.20010922124022.026dbba0@pop.ntlworld.com> X-Sender: sjmurdoch@pop.ntlworld.com X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Date: Sat, 22 Sep 2001 12:46:02 +0100 To: caml-list@inria.fr From: Steven Murdoch Subject: [Caml-list] Haskell features in O'Caml Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I've been using Haskell a little for the past year or so and I like quite a few of it's features, more recently I thought I'd look into O'Caml and I've been impressed by it's speed and versatility but I was wondering if it had some features found in Haskell. The main one I would like is the type assertion facility of Haskell. For example, one might write: mul :: Int -> Int -> Int mul a b = a * b The Haskell compiler will deduce the type of mul from the second line in a similar way to O'Caml and if it does not match the first line an error is raised. I find that this catches a lot of my mistakes and it would be great if O'Caml has a similar way to check whether the implied type of a function matches (or is a subtype of) an explicit definition. Another feature I would like is whether it is possible to define custom operators that can be put between it's operands rather than in front of them. For example if max gives the maximum of two arguments it can be applied normally, i.e. "max 2 3" will return 3, but "2 `max` 3" will also return 3. Also if a function is named using operator symbols it can be used as an operator, e.g if &&& is defined as: (&&&) :: Int -> Int -> Int x &&& y = max x y then "2 &&& 3" will return 3 This can lead to some very easy to read programs so I would like to know if either or both of these ways of defining operators has a equivalent in O'Caml. Thanks in advance, Steven Murdoch. -- email: steven@murdomedia.net web: http://www.murdomedia.net/ PGP/GnuPG keys: http://www.murdomedia.net/keys.html ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr