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 MAA31822; Tue, 14 Oct 2003 12:37:40 +0200 (MET DST) 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 MAA14272 for ; Tue, 14 Oct 2003 12:37:39 +0200 (MET DST) Received: from mail2.tpgi.com.au (mail.tpgi.com.au [203.12.160.58]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h9EAbb112069 for ; Tue, 14 Oct 2003 12:37:38 +0200 (MET DST) Received: from 203-219-67-43-syd-ts23-2600.tpgi.com.au (203-219-67-43-syd-ts23-2600.tpgi.com.au [203.219.67.43]) by mail2.tpgi.com.au (8.12.10/8.12.10) with ESMTP id h9EAbUtF013801; Tue, 14 Oct 2003 20:37:31 +1000 Subject: Re: [Caml-list] Is arrow programming impossible in ocaml? From: skaller Reply-To: skaller@ozemail.com.au To: Nick Name Cc: caml-list@inria.fr In-Reply-To: <200310140159.20515.nick.name@inwind.it> References: <200310140159.20515.nick.name@inwind.it> Content-Type: text/plain Message-Id: <1066127826.15739.80.camel@pelican> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 14 Oct 2003 20:37:07 +1000 Content-Transfer-Encoding: 7bit X-Kaspersky-Antivirus: Passed X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 ozemail:01 higher-order:01 combinator:01 val:01 val:01 ocaml:01 ocaml:01 int:01 rec:01 rec:01 float:02 wrote:03 arrow:95 let:04 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, 2003-10-14 at 09:59, Nick Name wrote: > Hi all, I am trying to work on a project where I need ocaml efficiency > type ('a,'b) t = 'a -> 'b > > let rec arr f = f > > let a = arr (fun x -> x) > - > > and "a" is typed like '_a -> '_a , where I would like it to be typed 'a > -> 'a. > > Does anyone think I have other possibilities in writing that kind of > higher-order combinator based code, or is it impossible? It works fine with an annotation: # type ('a,'b) t = 'a -> 'b let rec arr f = f let a = arr (fun x -> x) ;; type ('a, 'b) t = 'a -> 'b val arr : 'a -> 'a = val a : '_a -> '_a = # let a:('a,'a) t = (fun x -> x) ;; val a : ('a, 'a) t = # a 1;; - : int = 1 # a 1.1;; - : float = 1.1 # ------------------- 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