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 JAA08892; Wed, 25 Apr 2001 09:34:15 +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 JAA08914 for ; Wed, 25 Apr 2001 09:34:14 +0200 (MET DST) Received: from mta5.snfc21.pbi.net (mta5.snfc21.pbi.net [206.13.28.241]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f3P7YCP06987 for ; Wed, 25 Apr 2001 09:34:13 +0200 (MET DST) Received: from checkerlap.d6.com ([64.160.53.33]) by mta5.snfc21.pbi.net (Sun Internet Mail Server sims.3.5.2000.01.05.12.18.p9) with ESMTP id <0GCC001CB7O9B7@mta5.snfc21.pbi.net> for caml-list@inria.fr; Wed, 25 Apr 2001 00:33:48 -0700 (PDT) Date: Wed, 25 Apr 2001 00:35:26 -0700 From: Chris Hecker Subject: Re: [Caml-list] Subtypes in Ocaml In-reply-to: X-Sender: def6@shell16.ba.best.com To: Mark Wotton hons2001 , caml-list@inria.fr Message-id: <4.3.2.7.2.20010425002928.00d588b0@shell16.ba.best.com> MIME-version: 1.0 X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Content-type: text/plain; charset="us-ascii" References: Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk >Patternmatching seems to do it. if this isn't the right way to do it, >please, someone let me know before i do something stupid. I'm not 100% sure what you're saying. My first interpretation of your question leads me to say "this is what variants and pattern matching are all about". Since a variant is a union type, it can be a Literal and just an expression and pattern matching will let you choose which to interpret it as. My second interpretation is that you want to have a function typed to only take a subset of the variant type. In this case, you can either use exceptions (the default pattern match one, or one raised with a | _ -> failwith "bad type" if you don't want the compiler warnings), or I think you can do something with polymorphic variants, but I must admit to being kind of confused by them. Chris ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr