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 8E6517F7C2 for ; Thu, 6 Feb 2014 18:23:35 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of lukstafi@gmail.com) identity=pra; client-ip=209.85.212.177; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="lukstafi@gmail.com"; x-sender="lukstafi@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of lukstafi@gmail.com designates 209.85.212.177 as permitted sender) identity=mailfrom; client-ip=209.85.212.177; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="lukstafi@gmail.com"; x-sender="lukstafi@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-wi0-f177.google.com) identity=helo; client-ip=209.85.212.177; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="lukstafi@gmail.com"; x-sender="postmaster@mail-wi0-f177.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AngCAJHE81LRVdSxlGdsb2JhbABZg0RXrmaHN4hUgQMIFg4BAQEBBwsLCRIqgiUBAQQBQAEbHQEDAQsGBQQBBjshAQERAQUBHAYTh3ABAwkIDaA+jF6DCZNeChknDWSIBhEBBQyMWIIWB4Q4BJY/gWyBMossg1YYKYRaOw X-IPAS-Result: AngCAJHE81LRVdSxlGdsb2JhbABZg0RXrmaHN4hUgQMIFg4BAQEBBwsLCRIqgiUBAQQBQAEbHQEDAQsGBQQBBjshAQERAQUBHAYTh3ABAwkIDaA+jF6DCZNeChknDWSIBhEBBQyMWIIWB4Q4BJY/gWyBMossg1YYKYRaOw X-IronPort-AV: E=Sophos;i="4.95,793,1384297200"; d="scan'208";a="57198988" Received: from mail-wi0-f177.google.com ([209.85.212.177]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 06 Feb 2014 18:23:35 +0100 Received: by mail-wi0-f177.google.com with SMTP id e4so41194wiv.10 for ; Thu, 06 Feb 2014 09:23:35 -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; bh=tflUu/pChKlImpCxM9GCRnck0leElubk1xCZGeNWEhg=; b=U8GqRWyv6OLmoZA5dTIX9WCQ16XMXFscN2QeOWsExcZ8wsXKZkiyx+zVrglOlvWMS8 lKTwNPTbchOVedldPk5t+uQDPlCWx9gtOz50FYsAWp7eGHkPudUGRrLU3EyS4t9Lqavp waEyNGeCkKVBwsqocDPHkzvx/QaNPfPsbSky/G7ht8rz1sj62f3kAe/qnyHeS1H5Q4CE 2FhAiNCT7V54BUWWLFUW8r0tcBtceTioDzbRISggbMrPWnz9XQ5yS2mvIFbpxxJOHo8S uHpzqhl0Sc1QuayGHrMv18Jph/Dk/yuuN25mO93FpShSxJ0LdJMUmy3VGE7n7RGhq6Ti 1CZQ== X-Received: by 10.194.109.68 with SMTP id hq4mr7030972wjb.12.1391707414940; Thu, 06 Feb 2014 09:23:34 -0800 (PST) MIME-Version: 1.0 Received: by 10.227.49.71 with HTTP; Thu, 6 Feb 2014 09:23:14 -0800 (PST) In-Reply-To: <52F3C3A1.8060500@gmail.com> References: <52F3C3A1.8060500@gmail.com> From: Lukasz Stafiniak Date: Thu, 6 Feb 2014 18:23:14 +0100 Message-ID: To: =?ISO-8859-1?Q?M=E1rio_Jos=E9_Parreira_Pereira?= Cc: "caml-list@inria.fr" Content-Type: multipart/alternative; boundary=089e0102e6da195cde04f1c022c7 Subject: Re: [Caml-list] Type of term --089e0102e6da195cde04f1c022c7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Thu, Feb 6, 2014 at 6:17 PM, M=E1rio Jos=E9 Parreira Pereira < mariojppereira@gmail.com> 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. > > Besides GADTs, another thing that comes to mind is "module type of": http://caml.inria.fr/pub/docs/manual-ocaml-400/manual021.html#toc82 There is even pattern matching to recover a module from a module value (first-class modules), but it doesn't benefit from knowing the type of the module. --089e0102e6da195cde04f1c022c7 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On T= hu, Feb 6, 2014 at 6:17 PM, M=E1rio Jos=E9 Parreira Pereira <marioj= ppereira@gmail.com> wrote:
Hi all,

Is there any way to get the type of (part of) a program? Something like:
=A0 =A0type_of(M) =3D sigma
computing the type of program M as sigma so I can pattern match it.


Besides GADTs, another thing that come= s to mind is "module type of":


There is even pattern matching to recover a module from= a module value (first-class modules), but it doesn't benefit from know= ing the type of the module.
--089e0102e6da195cde04f1c022c7--