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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 2C7FB7F7C2 for ; Thu, 6 Feb 2014 20:02:30 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.214.54; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.214.54 as permitted sender) identity=mailfrom; client-ip=209.85.214.54; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-bk0-f54.google.com) identity=helo; client-ip=209.85.214.54; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-bk0-f54.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApgBAOLa81LRVdY2m2dsb2JhbABZg0RXvnGBBQgWDgEBAQEBBgsLCRQogiUBAQQBJxkBGx0BAwELBgULDS4hAQERAQUBHAYTCIdoAQMJCA2gAoxegwmTYQoZJw1kiAYRAQUMjFiCFgeEOAEDlj+BbIEyiyyDVhgphFo7 X-IPAS-Result: ApgBAOLa81LRVdY2m2dsb2JhbABZg0RXvnGBBQgWDgEBAQEBBgsLCRQogiUBAQQBJxkBGx0BAwELBgULDS4hAQERAQUBHAYTCIdoAQMJCA2gAoxegwmTYQoZJw1kiAYRAQUMjFiCFgeEOAEDlj+BbIEyiyyDVhgphFo7 X-IronPort-AV: E=Sophos;i="4.95,795,1384297200"; d="scan'208";a="57209940" Received: from mail-bk0-f54.google.com ([209.85.214.54]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 06 Feb 2014 20:02:29 +0100 Received: by mail-bk0-f54.google.com with SMTP id u14so747184bkz.41 for ; Thu, 06 Feb 2014 11:02:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=gNTK/3uS5E7ttU8DT0IbSb6GnduVgSKbGxVyIGHnmNM=; b=aKvmYbkZk2QDYfNJOiSoEeqTeupyeXm2BQzImR1iHw72dI/gOVEHkWzv5JwgXTJVYL rIUHOuOsDqaoydOx46LgvngNX/loi1k0cgPy5hw+gos82TJvrtZgfIXbAtlEaQgUGW6Q bwguS7KC9MpOs8bL72KE7Nna8h9Mangbjl5kXjwSYoCUngPNokCb7E3+qbP0ta1Cp0AI DYLEyKqLa3xqxy3YYxIRBthslS1f2EYq+gO8kqmctA7wc3gtpNfyr61VYPZJK8hTWAU7 bbj6sd1wn7EKlZ1Ixe1ZTRVpUxfAR45Px6Uk07q3T4idXN+Fb9uTGP0N1ymuTH5MY+I/ 1Qog== X-Received: by 10.204.200.138 with SMTP id ew10mr1862357bkb.34.1391713349092; Thu, 06 Feb 2014 11:02:29 -0800 (PST) MIME-Version: 1.0 Received: by 10.205.45.5 with HTTP; Thu, 6 Feb 2014 11:01:48 -0800 (PST) In-Reply-To: <52F3C710.4020500@gmail.com> References: <52F3C3A1.8060500@gmail.com> <52F3C710.4020500@gmail.com> From: Gabriel Scherer Date: Thu, 6 Feb 2014 20:01:48 +0100 Message-ID: To: =?ISO-8859-1?Q?M=E1rio_Jos=E9_Parreira_Pereira?= Cc: Lukasz Stafiniak , "caml-list@inria.fr" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] Type of term > 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 No, there is not. What are you trying to do? On Thu, Feb 6, 2014 at 6:32 PM, M=E1rio Jos=E9 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=E1rio > > Em 06-02-2014 17:17, Lukasz Stafiniak escreveu: > > On Thu, Feb 6, 2014 at 6:17 PM, M=E1rio Jos=E9 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. > >