From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p538liqu012158 for ; Fri, 3 Jun 2011 10:47:44 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiQFADOf6E3UTWUIjmdsb2JhbAAyCxaESZNRjh4UAQEBAQkLCQkSBiG7J4J6AY1tBYErg2yBCpUyiwE X-IronPort-AV: E=Sophos;i="4.65,314,1304287200"; d="scan'208";a="84581500" Received: from mx4.wp.pl ([212.77.101.8]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 03 Jun 2011 10:47:38 +0200 Received: (wp-smtpd smtp.wp.pl 16913 invoked from network); 3 Jun 2011 10:47:36 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wp.pl; s=1024a; t=1307090856; bh=hWqGl2Guh1UZtDs2e4ZBuQljFdI9o/rwEAk8mRxKL+0=; h=From:To:Subject; b=SaDY9WWAFcHQ2hgD8psqfg8tMUGIg+iJP512xrgxkvozMWKa+Hzy3yq02SVOn2m5P J9Ws7LR1YtsRYkguyGazLUHjBuqy2rZah9hkTfaGGESZEA+Q4Rxs+mQhr9IrXqGR0y CMwmUBZ8uJF5qGENQmaWq5KNTDsq+L+7htb50gC8= Received: from 18-161.2-0.pl (HELO [192.168.1.101]) (d0@[91.189.18.161]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with AES256-SHA encrypted SMTP for ; 3 Jun 2011 10:47:36 +0200 Message-ID: <4DE89FA5.9040507@wp.pl> Date: Fri, 03 Jun 2011 10:47:33 +0200 From: Dawid Toton User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 MIME-Version: 1.0 To: caml-list@inria.fr Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-WP-AV: skaner antywirusowy poczty Wirtualnej Polski S. A. X-WP-SPAM: NO 0000000 [8cMU] Subject: [Caml-list] Forget a type without Obj.magic I have the following situation: ______ type 'a consumer = 'a -> unit type 'a inactive = ('a consumer -> unit) list type active val activate : 'a consumer -> 'a inactive -> active type bottom = unit val forget_type : 'a inactive -> bottom inactive ______ let activate consumer inactive = let act inact = inact consumer in List.map act inactive let bottom = () let forget_type inactive = let forget inact = (fun simple_consumer -> inact (fun _ -> simple_consumer bottom) ) in (List.map forget inactive : unit inactive ) ______ I see that the function forget_type above is a waste of time: it repackages functions that take () to functions that ignore the argument. But the simple_consumer already ignores the () argument, since there is no much use of it anyway. My question is: how to change the above example, so that the forget_type becomes just a typecast (or maybe a constant time operation)? I think that the type and value called bottom in the above code are currently not what I really want. Maybe even it should be called "top" instead? The argument of simple_consumer should have a type of "values impossible to use". How to express this? Dawid