From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 7F6E3BBAF for ; Wed, 15 Oct 2008 17:03:41 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmoDALij9UiVnFmTiGdsb2JhbACTYAEBARUipgCHMD6Baw X-IronPort-AV: E=Sophos;i="4.33,416,1220220000"; d="scan'208";a="18770076" Received: from mail.uj.edu.pl ([149.156.89.147]) by mail1-smtp-roc.national.inria.fr with ESMTP; 15 Oct 2008 17:03:26 +0200 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=ISO-8859-1; format=flowed Received: from [137.73.5.196] by mail.uj.edu.pl (Sun Java(tm) System Messaging Server 6.3-5.02 (built Oct 12 2007; 32bit)) with ESMTPA id <0K8S00KXDCHL5M20@mail.uj.edu.pl> for caml-list@yquem.inria.fr; Wed, 15 Oct 2008 17:03:21 +0200 (CEST) Message-id: <48F60638.6040101@uj.edu.pl> Date: Wed, 15 Oct 2008 16:03:20 +0100 From: Dawid Toton User-Agent: Thunderbird 1.5.0.12 (X11/20080804) To: caml-list@yquem.inria.fr Subject: Quantifier in the type X-Spam: no; 0.00; quantifier:01 val:01 val:01 mli:01 intentional:01 forall:01 quantifier:01 ocaml:01 translated:01 vvv:98 vvv:98 int:01 int:01 argument:02 match:02 Just an elementary question. I put 'a in the interface: val fu : 'a -> 'a and int in the implementation: let fu x = x + 1 So I have universal quantification: for any type 'a function fu can consume the argument. So my implementation doesn't comply with that universal quatification. And the message I get is following: Values do not match: val fu : int -> int is not included in val fu : 'a -> 'a So the declaration of value in mli file is called simply a 'value'. Is it intentional? I thought that value and it's declaration are separate notions? My reading of " val fu : 'a -> 'a " is: some partiular value vvv that belongs to set of values that satisfy "forall 'a : (vvv can be used with ('a -> 'a) type)" But if I write let (bar : 'a -> 'a ) = (fun x -> x + 1) I create a value that belongs to set "exists 'a : (vvv can be used with ('a -> 'a) type)" So it's the other quantifier. I think that the quantifier has to be part of type, since a type is set of values (and the quantifier plays important role when describing some of such sets). So my question is: since we see the same string " 'a -> 'a " that refers to different types in different contexts, what are the rules? How is type definition in OCaml translated to a type? Dawid