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 A7C0F7F164 for ; Sun, 6 Mar 2016 16:30:27 +0100 (CET) IronPort-PHdr: 9a23:kkU0KhOxPRWEpugnw7kl6mtUPXoX/o7sNwtQ0KIMzox0Kf35rarrMEGX3/hxlliBBdydsKIbzbWH+P+/EUU7or+/81k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZvIaytQ8iJ35vxiLH5pMKbSj4LrQT+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf9d32JiKAHbtR/94sCt4MwrqHwI6LoJvvRNWqTifqk+UacQTHF/azh0t/vQqALbQACTynwZW2QQ2loUUkmWpC39C7j2qTT7sKJj3y/SF9f7Qb0uXTO9p/NkTwT3iSFCKXsz2H7agIp8gfQIjgimokldyoXNfYyOfNV3ZLnccs4XDT5OV9xLViNcD6u5ZpcPSewIMuFJpszg4VIF6xmmU1r/TNjzwyNF0yellZYx1P4sRESbhQE= Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=garrigue@math.nagoya-u.ac.jp; spf=None smtp.mailfrom=garrigue@math.nagoya-u.ac.jp; spf=None smtp.helo=postmaster@mailhost.math.nagoya-u.ac.jp Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of garrigue@math.nagoya-u.ac.jp) identity=pra; client-ip=133.6.130.5; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="garrigue@math.nagoya-u.ac.jp"; x-sender="garrigue@math.nagoya-u.ac.jp"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of garrigue@math.nagoya-u.ac.jp) identity=mailfrom; client-ip=133.6.130.5; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="garrigue@math.nagoya-u.ac.jp"; x-sender="garrigue@math.nagoya-u.ac.jp"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mailhost.math.nagoya-u.ac.jp) identity=helo; client-ip=133.6.130.5; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="garrigue@math.nagoya-u.ac.jp"; x-sender="postmaster@mailhost.math.nagoya-u.ac.jp"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0D3AQC5TNxW/wWCBoVdhAxtAaoOiHmHNgENgWkhhW4CgVMUAQEBAQEBAQFjJ4ItghUBAQQnEwYDASoLAQEOCyUWC0USBhMSh3sDEQ+vWoUtAoUvAx8vhAMBAQEBAQEBAQIBAQEBAQEBAQEBAQ4BBogGCIJGhDiDLYEPhiEMgTOGSIkHhWOICoIuhnuFUY5VHgEBQoIwgUNbiUABAQE X-IPAS-Result: A0D3AQC5TNxW/wWCBoVdhAxtAaoOiHmHNgENgWkhhW4CgVMUAQEBAQEBAQFjJ4ItghUBAQQnEwYDASoLAQEOCyUWC0USBhMSh3sDEQ+vWoUtAoUvAx8vhAMBAQEBAQEBAQIBAQEBAQEBAQEBAQ4BBogGCIJGhDiDLYEPhiEMgTOGSIkHhWOICoIuhnuFUY5VHgEBQoIwgUNbiUABAQE X-IronPort-AV: E=Sophos;i="5.22,546,1449529200"; d="scan'208";a="206206543" Received: from rabbit.math.nagoya-u.ac.jp (HELO mailhost.math.nagoya-u.ac.jp) ([133.6.130.5]) by mail2-smtp-roc.national.inria.fr with ESMTP; 06 Mar 2016 16:30:18 +0100 Received: from mailhost.math.nagoya-u.ac.jp (localhost [127.0.0.1]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTP id ACDB36308 for ; Mon, 7 Mar 2016 00:30:15 +0900 (JST) Received: from mailhost.math.nagoya-u.ac.jp (rabbit-172.math.nagoya-u.ac.jp [172.16.254.254]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTP id 272CA4164; Mon, 7 Mar 2016 00:30:15 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=math.nagoya-u.ac.jp; h= subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=alpha; bh=1JY1Ybgg/KcxQDhPyYXInEKG3+g=; b=Uuc393c0gPMPoXj5nZXS4e5KOnuW gG+e+qbeDCaGNvFuBkSUmQPYbC2XLEknbXNyt+i5j9BwqsUle9oNDXtY7EnSAl8/ kCrtsC7UKAdXLEFuT0//7zLOhVIPobJ6Cjfry5WMB3xaH16oYjuX9DJxDXrTG4ww ICCFmgus77qje1w= DomainKey-Signature: a=rsa-sha1; h=Received:Subject:Mime-Version:Content-Type:From:In-Reply-To:Date:Cc:Content-Transfer-Encoding:Message-Id:References:To:X-Mailer; b=WZNmH4iB49TIL5mEfw89bk9pQoBeOSWMSWKS+5DXBIEIGgohVtAUvromTkDwS7+cX4e5WWZTukXiNfHFDFUwbBdp3rEJVyr/zP3vM7KdY2c8WxBIMoDZQ845WDs1loGMFq12bPGhE+6eAblftdtEE54QVzC22YsQXp6vWXaH2LY=; c=nofws; d=math.nagoya-u.ac.jp; q=dns; s=alpha Received: from [172.16.200.157] (p14092-ipbfp202kouchi.kochi.ocn.ne.jp [114.168.73.92]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTPSA id 2D5626661; Mon, 7 Mar 2016 00:29:22 +0900 (JST) Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Content-Type: text/plain; charset=us-ascii From: Jacques Garrigue In-Reply-To: <20160306013332.GA27650@frosties> Date: Mon, 7 Mar 2016 00:30:14 +0900 Cc: OCaml Mailing List Content-Transfer-Encoding: quoted-printable Message-Id: <4C32FD84-31A8-4516-9DB1-93B4B0CF9DE2@math.nagoya-u.ac.jp> References: <20160306013332.GA27650@frosties> To: Goswin von Brederlow X-Mailer: Apple Mail (2.3112) Subject: Re: [Caml-list] Error: In this definition, a type variable cannot be deduced from the type parameters. 2016/03/06 10:33, Goswin von Brederlow : >=20 > Hi, >=20 > if I use the type aliases in the commented out lines then I get: >=20 > Error: In this definition, a type variable cannot be deduced > from the type parameters. >=20 > To me the types sure do look alike and nothing is private or hidden my > a signature. So what am I missing? >=20 > MfG > Goswin The problem is that you are using abstract types in separate modules. As a result, the type system cannot recognize them as injective, and gives the above error message. You should either make it a datatype or a structural type: type +'a qObject' =3D Q of 'a or type +'a qObject' =3D [`QObject' of 'a] Jacques Garrigue > ------------------------------------------------------------------------- > module Proxy =3D struct > type +'a t > end >=20 > module QObject =3D struct > type +'a qObject' > type +'a t =3D 'a qObject' Proxy.t >=20 > class ['a] qObject proxy =3D object > constraint 'a =3D 'b qObject' as 'a > method proxy : 'a Proxy.t =3D proxy > end > end >=20 > module QWidget =3D struct > type +'a qWidget' > type +'a t =3D 'a qWidget' QObject.t >=20 > external add : 'a qWidget' QObject.qObject' Proxy.t -> 'b qWidget' QObje= ct.qObject' Proxy.t -> unit =3D "add" > (* > external add : 'a t -> 'b qWidget' QObject.t -> unit =3D "add" > *) > class ['a] qWidget proxy =3D object > constraint 'a =3D 'b qWidget' QObject.qObject' as 'a > inherit ['a] QObject.qObject proxy > method add : 'c 'd . ('d qWidget' QObject.qObject' #QObject.qObject as= 'c) -> unit =3D fun w -> add proxy w#proxy > end > end >=20 > module QButton =3D struct > type +'a qButton' > type +'a t =3D 'a qButton' QWidget.t >=20 > external set : 'a qButton' QWidget.qWidget' QObject.qObject' Proxy.t -> = 'b QWidget.qWidget' QObject.qObject' Proxy.t -> unit =3D "set" > (* > external set : 'a t -> 'b QWidget.t -> unit =3D "set" > *) > class ['a] qButton proxy =3D object > constraint 'a =3D 'b qButton' QWidget.qWidget' QObject.qObject' as 'a > inherit ['a] QWidget.qWidget proxy > method set : 'c 'd . ('c QWidget.qWidget' QObject.qObject' #QWidget.qW= idget as 'd) -> unit =3D fun w -> set proxy w#proxy > method text =3D "button" > end > end >=20 > let qObject_proxy : unit QObject.t =3D Obj.magic 0 > let qWidget_proxy : unit QWidget.t =3D Obj.magic 0 > let qButton_proxy : unit QButton.t =3D Obj.magic 0 > let qObject =3D new QObject.qObject qObject_proxy > let qWidget =3D new QWidget.qWidget qWidget_proxy > let qButton =3D new QButton.qButton qButton_proxy > let () =3D qWidget#add qWidget > let () =3D qWidget#add qButton > let () =3D qButton#set qWidget > let () =3D qButton#set qButton > let () =3D qButton#add qWidget > let () =3D qButton#add qButton >=20 > --=20 > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs