From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p8RDGlns017237 for ; Tue, 27 Sep 2011 15:16:47 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhACADzMgU7RVdK2kWdsb2JhbABBp3EIFAEBAQEJCQ0HEiiBUwEBAQMBEgITEwYBOAEDAQsBBQU0EjQBBQEcBjWHVptrCo4ohSOJKQIEBoYlYASHcItihkyGPj2BSII0 X-IronPort-AV: E=Sophos;i="4.68,449,1312149600"; d="scan'208";a="110756176" Received: from mail-iy0-f182.google.com ([209.85.210.182]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 27 Sep 2011 15:16:41 +0200 Received: by iadk27 with SMTP id k27so11998727iad.27 for ; Tue, 27 Sep 2011 06:16:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; bh=8/xolBtk08IIRtwj2lz9U+jZqsNJKSl/XS6ywLXzLlU=; b=Px4KenSmFFr8Q7FyGigWL/hZMpqsqYwGoahaqOFmmwmFNwfmoqsAPppLymT2+jN7/Q 6uv86eAWTW+TCBtgbuO8FUK07UEJEx5V3JFqTEuo9lwGjIoC2MzuGbZepS8iLkycjf3+ SJutL50e0G3MRdlWzuPoBS5jsvI3pX4tFF47o= Received: by 10.42.145.194 with SMTP id g2mr9413935icv.36.1317129400084; Tue, 27 Sep 2011 06:16:40 -0700 (PDT) Received: from tet.garrigue.jp (58x158x128x157.ap58.ftth.ucom.ne.jp. [58.158.128.157]) by mx.google.com with ESMTPS id el2sm30576360ibb.10.2011.09.27.06.16.38 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 27 Sep 2011 06:16:39 -0700 (PDT) Sender: Jacques Garrigue Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Jacques Garrigue In-Reply-To: Date: Tue, 27 Sep 2011 22:16:36 +0900 Cc: OCaML Mailing List Content-Transfer-Encoding: 7bit Message-Id: <6A020199-D53D-443E-9683-D225D495AEB5@math.nagoya-u.ac.jp> References: To: Walter Cazzola X-Mailer: Apple Mail (2.1084) Subject: Re: [Caml-list] still silly issues on polymorphic types On 2011/09/27, at 20:46, Walter Cazzola wrote: > Dear all, > I'm still playing around with functors, modules and polymorphism but > I've some problems with this last concept. > > In the attached files I have tried to implement a sort of function with > a variable number of arguments (based on continuation) and to generalize > the approach I've used a functor (OpVarADT) where I defined the > operation of type 'a -> 'b -> 'c but seems that it is not general enough > to contain int->int->int or 'a -> 'a list -> 'a list > > This is the functor instantiation with the errors I get: > > # module M0 = Continuation(StringConcat) ;; > Error: Signature mismatch: > Modules do not match: > sig val op : 'a -> 'a list -> 'a list val init : 'a list end > is not included in > OpVarADT.OpVarADT > Values do not match: > val op : 'a -> 'a list -> 'a list > is not included in > val op : 'a -> 'b -> 'c It seems that your continuation functor has not the right specification. Namely, there is no way you can provide a meaningful function of type 'a -> 'b -> 'c (i.e. a -> b -> c for all possible a, b, and c) other than raising an exception or going into an infinite loop. I think that you meant something else, like type a and b and c val op : a -> b -> c which would let you give a specific function for op. Jacques Garrigue