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 762247F7C2 for ; Thu, 6 Feb 2014 18:45:44 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of raphlalou@gmail.com) identity=pra; client-ip=209.85.216.50; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="raphlalou@gmail.com"; x-sender="raphlalou@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of raphlalou@gmail.com designates 209.85.216.50 as permitted sender) identity=mailfrom; client-ip=209.85.216.50; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="raphlalou@gmail.com"; x-sender="raphlalou@gmail.com"; 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@mail-qa0-f50.google.com) identity=helo; client-ip=209.85.216.50; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="raphlalou@gmail.com"; x-sender="postmaster@mail-qa0-f50.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjwCAK7J81LRVdgylGdsb2JhbABZg0RLDIMBu3CBBAgWDgEBAQEHCwsJEiqCJQEBBSMEGQEbHQEDDAYFCw0CAiYCAiEBAREBBQEcBhOHcAEDEQ2gOIwLU4MJk1sKGScNZIgGEQEFDIEdizuBYzMHgm+BSQSWP4FsgTKLLINWGCmEWTw X-IPAS-Result: AjwCAK7J81LRVdgylGdsb2JhbABZg0RLDIMBu3CBBAgWDgEBAQEHCwsJEiqCJQEBBSMEGQEbHQEDDAYFCw0CAiYCAiEBAREBBQEcBhOHcAEDEQ2gOIwLU4MJk1sKGScNZIgGEQEFDIEdizuBYzMHgm+BSQSWP4FsgTKLLINWGCmEWTw X-IronPort-AV: E=Sophos;i="4.95,793,1384297200"; d="scan'208";a="48071286" Received: from mail-qa0-f50.google.com ([209.85.216.50]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 06 Feb 2014 18:45:43 +0100 Received: by mail-qa0-f50.google.com with SMTP id cm18so3369543qab.9 for ; Thu, 06 Feb 2014 09:45:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=mKnNWH2r+ovfifSMhx+sYuSshlZTk5yi+oDkuBrceVQ=; b=XX8SfiPS8DD2Se4xq09GGHyHLYpjhM6GO80AI7tTfDlRPVTlNFo6wtsCLvn8Ig0rJG afpkZG88EABmLC4MqZtMwcHFFQu2Peayt7g8+7PlWAKXQ5ZGN8k4/efrsVKUiLp+LR/E u2roZK1GjwPOytUQORnnVcE7Ch1rtxUspfkGNYMFOb1PMthGsUhpc7MJQ6PP1dKOER8L JFsL3bCRguDRJO69OQGJ7/RTvoXeUzJ9F7usyW5hGfcpcR4ZTZ1pM3m8e9GfFlevOXb0 3Ll5R8VkYZbX1361ggupldxoXqb6CgM21tXjDX6OD2ekf7Yr/tuKCu2U+NAltkTuskQ5 XQqw== MIME-Version: 1.0 X-Received: by 10.224.22.3 with SMTP id l3mr14374074qab.103.1391708741283; Thu, 06 Feb 2014 09:45:41 -0800 (PST) Received: by 10.96.149.168 with HTTP; Thu, 6 Feb 2014 09:45:41 -0800 (PST) In-Reply-To: <52F3C710.4020500@gmail.com> References: <52F3C3A1.8060500@gmail.com> <52F3C710.4020500@gmail.com> Date: Thu, 6 Feb 2014 17:45:41 +0000 Message-ID: From: =?UTF-8?Q?Rapha=C3=ABl_Proust?= To: =?UTF-8?Q?M=C3=A1rio_Jos=C3=A9_Parreira_Pereira?= Cc: "caml-list@inria.fr" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] Type of term $ echo "let f x =3D x;;" | ocaml | grep ':' | sed 's/^.*: //' | sed 's/ =3D= .*//' 'a -> 'a (Replace `let f x =3D x` with any ocaml expression.) More seriously, you might want to have a look at the compiler libs. On Thu, Feb 6, 2014 at 5:32 PM, M=C3=A1rio Jos=C3=A9 Parreira Pereira wrote: > Hi Lukasz, > > Thank you for your answer but I really can't see how GADTs can help me. > > I was just simply wandering if there wasn't any OCaml function that would > work like: > type_of(let f x =3D x) =3D 'a->'a > > There is, something that would compute exactly the same outcome as the > Damas-Milner algorithm W. > > Bests, > M=C3=A1rio > > Em 06-02-2014 17:17, Lukasz Stafiniak escreveu: > > On Thu, Feb 6, 2014 at 6:17 PM, M=C3=A1rio Jos=C3=A9 Parreira Pereira > wrote: >> >> Hi all, >> >> Is there any way to get the type of (part of) a program? Something like: >> type_of(M) =3D sigma >> computing the type of program M as sigma so I can pattern match it. > > > No. However, if you really need this rather than being confused by > programming patterns from Java / C# / C++, you should learn about GADTs. > http://caml.inria.fr/pub/docs/manual-ocaml-400/manual021.html#toc85 > > Cheers. > > --=20 ______________ Rapha=C3=ABl Proust