From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.9 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id ADDB4BC6B for ; Sat, 28 Jul 2007 20:57:42 +0200 (CEST) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.186]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6SIvgFh029016 for ; Sat, 28 Jul 2007 20:57:42 +0200 Received: by nf-out-0910.google.com with SMTP id g13so116837nfb for ; Sat, 28 Jul 2007 11:57:41 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=ikmxfVavpZxaod1zJo0tMZt96lcY1wVG5A0aFJuvnuaYmQ6LiWZP4wxnEIMrxmBKlMaxAy1suPPtZqIACAcRfAdf3I4/HfdyzT9DkBRisZMAuNuCGLPKTOFA3B1xZImQGd5Q6+KABfYff4HUdyoUU91tUMgAwAi5uE4RAtxRRlI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=tUsptjBcugCmIf+05jvGW81uNY+WkYB0efXHbOcpT3HbL3XusoEa88fkBl9/gNRIzs5783wKP9oFzwGzZebAeA1JjRVLa49B/UILBbBbM/x1iXGoudHheJ/JVJjgyawlbK9PAZJjWWpN5fSGTPxC1iJfaJapNWpbSXFUQ5Hykeo= Received: by 10.86.4.2 with SMTP id 2mr2804367fgd.1185649061834; Sat, 28 Jul 2007 11:57:41 -0700 (PDT) Received: from ?192.168.0.2? ( [87.88.165.197]) by mx.google.com with ESMTPS id e9sm5164873muf.2007.07.28.11.57.40 (version=SSLv3 cipher=RC4-MD5); Sat, 28 Jul 2007 11:57:40 -0700 (PDT) Message-ID: <46AB91A2.2050203@lix.polytechnique.fr> Date: Sat, 28 Jul 2007 20:57:38 +0200 From: Arnaud Spiwack User-Agent: Thunderbird 2.0.0.5 (Windows/20070716) MIME-Version: 1.0 To: Caml List Subject: Re: [Caml-list] Void type? References: <875c7e070707272151v2dc46c2ap3f7ed4ebd005726e@mail.gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: Arnaud Spiwack X-Miltered: at discorde with ID 46AB91A6.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; lix:01 syntax:01 val:01 inherently:01 arnaud:01 arnaud:01 abstract:01 caml-list:01 match:02 revised:02 module:03 module:03 unit:03 element:03 let:03 > But can I pass [] to a function that expects a "void list"? > If you want to do this sort of things. Then you have two basic ways : 1/ using the revised syntax : type void = []; . which has an elimination principle let void_elim x = match x with []; 2/ using an abstract module with declarations : type void val void_elim : void -> 'a This module would be the generic representation of a void type. It can be instantiated by the concrete definitions in 1/. Another way is to cheat : type void = unit type void_elim = Obj.magic This implementation is sound since there is no way provided to build an element of type void, thus void elim will never be executed. Depending on what exactly you want to do you might disregard the elimination principle. But it's inherently part of the void logic. Regards, Arnaud Spiwack