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 mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTP id AA6417EEC4 for ; Fri, 26 Oct 2012 20:04:40 +0200 (CEST) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of mark@proof-technologies.com) identity=pra; client-ip=85.233.160.25; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="mark@proof-technologies.com"; x-sender="mark@proof-technologies.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of mark@proof-technologies.com designates 85.233.160.25 as permitted sender) identity=mailfrom; client-ip=85.233.160.25; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="mark@proof-technologies.com"; x-sender="mark@proof-technologies.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@outgoing-smtp.namesco.net) identity=helo; client-ip=85.233.160.25; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="mark@proof-technologies.com"; x-sender="postmaster@outgoing-smtp.namesco.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AikCAJXPilBV6aAZjWdsb2JhbABEhhiFVLZWIwEBAQEJCQsJEgUkgkgEgQcCJgI+BBEMhiOBeptFjliSa4EgilKDSYIRgRMDjgiHa4VmjUiBYw X-IronPort-AV: E=Sophos;i="4.80,654,1344204000"; d="scan'208";a="179118771" Received: from outgoing-smtp.namesco.net ([85.233.160.25]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 26 Oct 2012 20:04:40 +0200 Received: from [192.168.0.126] (helo=noddy.namesco.net) by outgoing-smtp.namesco.net with esmtp (Exim 4.67) (envelope-from ) id 1TRoGs-0005BJ-J8 for caml-list@inria.fr; Fri, 26 Oct 2012 19:04:38 +0100 Received: from webmail by noddy.namesco.net with local (Exim 4.72) (envelope-from ) id 1TRoE1-0004KM-4B for caml-list@inria.fr; Fri, 26 Oct 2012 19:01:41 +0100 To: From: =?utf-8?q?=22Mark=22?= Reply-To: =?utf-8?q?=22Mark=22?= MIME-Version: 1.0 X-Mailer: Namesco Webmail v3.0 Message-ID: <1351274501735@names.co.uk> Date: Fri, 26 Oct 2012 19:01:41 +0100 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-namesco: 192.168.0.171 X-Spam-Score: -1.4 (-) Subject: [Caml-list] accessing the type of a polymorphic parameter Hello. Is it possible in OCaml for a polymorphic function to somehow have access to the concrete type of an actual parameter used in a call of the function? For example, is there some way of writing a polymorphic function 'foo' list this: let foo x =3D match (type_of x) with Int -> .... | String -> .... where 'type_of' is some function that returns a representation of the concrete type of its argument. I want this because I want to implement an ad-hoc polymorphic function. I know this is outside the bounds of "normal" OCaml, but is there some nasty part of the language like Obj.magic that I could use to achieve this? Mark.