From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id A8ECABC84 for ; Thu, 31 Mar 2005 00:15:04 +0200 (CEST) Received: from pedigree.cs.ubc.ca (pedigree.cs.ubc.ca [142.103.6.50]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j2UMF3VF023196 for ; Thu, 31 Mar 2005 00:15:04 +0200 Received: from cascade.cs.ubc.ca (cascade.cs.ubc.ca [142.103.7.7]) by pedigree.cs.ubc.ca (8.12.10/8.11.4) with ESMTP id j2UMEvTN006970; Wed, 30 Mar 2005 14:14:57 -0800 (PST) Date: Wed, 30 Mar 2005 14:14:57 -0800 (PST) From: Christopher Dutchyn To: Jacques Carette Cc: Jon Harrop , caml-list@yquem.inria.fr Subject: Re: [Caml-list] Pervasives.compare output type In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at nez-perce with ID 424B24E7.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 pervasives:01 convincing:01 rec:01 conciseness:01 checker:01 haskell:01 checker:01 subtyping:01 simulated:01 pairs:01 caml-list:01 beginner's:01 ocaml:01 beginners:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: On Wed, 30 Mar 2005, Jacques Carette wrote: > The most convincing example I have seen is that an eval function for a > statically-typed language > let rec eval e = match e with | Lit n -> n > | Plus(a,b) -> (eval a) + (eval b) > | True -> true > | False -> false > | And(a,b) -> (eval a) && (eval b) > | If(t,c,a) -> if eval t then eval c else eval a > | IfZero e' -> (eval e') = 0 > is currently rejected in ML languages, but with GADTs the above can be > accepted, as it can't "go wrong". I've played a little with GADTs in GHC 6.4. What strikes me as most valuable about this example (besides its conciseness) it that it leverages the type-inferencer/checker in the metalanguage (Haskell) into a type-inferencer/checker for the object language. I'm trying to make it do subtyping by passing lists of types (simulated by pairs). -- Christopher Dutchyn UBC Computer Science > > Jacques > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >