On Thu, Feb 6, 2014 at 6:17 PM, Mário José 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) = 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.