From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 9B4867FBBC for ; Wed, 7 Jan 2015 14:50:16 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of goswin-v-b@web.de) identity=pra; client-ip=212.227.17.12; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="goswin-v-b@web.de"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of goswin-v-b@web.de designates 212.227.17.12 as permitted sender) identity=mailfrom; client-ip=212.227.17.12; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="goswin-v-b@web.de"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.web.de) identity=helo; client-ip=212.227.17.12; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="postmaster@mout.web.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlMAACY5rVTU4xEMnGdsb2JhbABc0WpDAQEBAQERAQEBAQEGDQkJFC6ETXs0BSghiCoBFASfc55aH4Q+kxWBEwWXLYYBDItYgXOCHoMxAQEB X-IPAS-Result: AlMAACY5rVTU4xEMnGdsb2JhbABc0WpDAQEBAQERAQEBAQEGDQkJFC6ETXs0BSghiCoBFASfc55aH4Q+kxWBEwWXLYYBDItYgXOCHoMxAQEB X-IronPort-AV: E=Sophos;i="5.07,714,1413237600"; d="scan'208";a="95620845" Received: from mout.web.de ([212.227.17.12]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 07 Jan 2015 14:50:15 +0100 Received: from frosties.localnet ([134.3.241.185]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0M8iH2-1XwiSY0RFU-00CDUo for ; Wed, 07 Jan 2015 14:50:14 +0100 Received: from mrvn by frosties.localnet with local (Exim 4.82) (envelope-from ) id 1Y8r01-0004gS-4Z for caml-list@inria.fr; Wed, 07 Jan 2015 14:50:13 +0100 Date: Wed, 7 Jan 2015 14:50:13 +0100 From: Goswin von Brederlow To: caml users Message-ID: <20150107135012.GA17784@frosties> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Provags-ID: V03:K0:mArLUPYxMp7/cqZkTLOQWwSC1rXeVYEqopgpzS6fJ+iRCKSuuMn eoB4zor9ib4dQBZqalLFQivm+y/a5rgO3HfuRHb6qY4yqy6yyzB8gRZlwFKQ0D1iDEKCTHB u/q4Z+gRXgjAgMbHe1h7n5XeVnoOXPojajVNsOe/0qjg66bWk8nYAHvB4JHn1h4yBvHvUy+ AbdUarXmEbZwqCkMZQj4A== X-UI-Out-Filterresults: notjunk:1; Subject: [Caml-list] Problem with universal functions in a module Hi, I have a functor that boxes a GADT type into an universal container. But then the problem is how to get the type back out again. Specifically I want to pass the data to a polymorphic function that doesn't care what type it gets since it will pattern match the GADT to determine the right type. But, because the argument is a GADT, ocaml complains after unboxing the type would escape its scope (see call_unboxed below). One can only call an universal function with the unboxed data and only records (and objects) can have universal functions. Problem is that I would like to keep the implementation of the helper record abstract and only provide a constructor (helper function below). But the constructor needs an universal function and function argument are only polymorphic (less general). A) why is a polymorphic function less general here? The print function is good enough for List.iter below or for constructing a helper but not indirectly via "M.helper fn". Why are function arguments less general than their original function? B) is there some way around this I'm not seeing? MfG Goswin --