caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Mário José Parreira Pereira" <mariojppereira@gmail.com>
To: Lukasz Stafiniak <lukstafi@gmail.com>
Cc: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] Type of term
Date: Thu, 06 Feb 2014 17:32:00 +0000	[thread overview]
Message-ID: <52F3C710.4020500@gmail.com> (raw)
In-Reply-To: <CAJMfKEW5B-k8p3-LPhASetv+RqjFPFiU9yG=3U9UeVdxD-2YRQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 941 bytes --]

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 = x) = 'a->'a

There is, something that would compute exactly the same outcome as the 
Damas-Milner algorithm W.

Bests,
Mário

Em 06-02-2014 17:17, Lukasz Stafiniak escreveu:
> On Thu, Feb 6, 2014 at 6:17 PM, Mário José Parreira Pereira 
> <mariojppereira@gmail.com <mailto:mariojppereira@gmail.com>> wrote:
>
>     Hi all,
>
>     Is there any way to get the type of (part of) a program? Something
>     like:
>        type_of(M) = 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.


[-- Attachment #2: Type: text/html, Size: 2262 bytes --]

  reply	other threads:[~2014-02-06 17:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-06 17:17 Mário José Parreira Pereira
2014-02-06 17:17 ` Lukasz Stafiniak
2014-02-06 17:32   ` Mário José Parreira Pereira [this message]
2014-02-06 17:45     ` Raphaël Proust
2014-02-06 19:01     ` Gabriel Scherer
2014-02-06 19:05       ` Simon Cruanes
2014-02-10  8:58     ` Goswin von Brederlow
2014-02-06 17:23 ` Lukasz Stafiniak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52F3C710.4020500@gmail.com \
    --to=mariojppereira@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=lukstafi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).