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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 21CA48018B for ; Tue, 4 Jul 2017 10:21:30 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=ygrek@autistici.org; spf=Pass smtp.mailfrom=ygrek@autistici.org; spf=Pass smtp.helo=postmaster@fragranza.investici.org Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of ygrek@autistici.org) identity=pra; client-ip=178.175.144.26; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="ygrek@autistici.org"; x-sender="ygrek@autistici.org"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of ygrek@autistici.org designates 178.175.144.26 as permitted sender) identity=mailfrom; client-ip=178.175.144.26; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="ygrek@autistici.org"; x-sender="ygrek@autistici.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of postmaster@fragranza.investici.org designates 178.175.144.26 as permitted sender) identity=helo; client-ip=178.175.144.26; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="ygrek@autistici.org"; x-sender="postmaster@fragranza.investici.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" IronPort-PHdr: =?us-ascii?q?9a23=3Az0ECIBQpowMmKR8l6pyO9t4vItpsv+yvbD5Q0YIu?= =?us-ascii?q?jvd0So/mwa68YxCN2/xhgRfzUJnB7Loc0qyN4v+mATRIyK3CmUhKSIZLWR4BhJ?= =?us-ascii?q?detC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+?= =?us-ascii?q?KPjrFY7OlcS30P2594HObwlSijewZbF/IA+qoQnNq8IbnZZsJqEtxxXTv3BGYf?= =?us-ascii?q?5WxWRmJVKSmxbz+MK994N9/ipTpvws6ddOXb31cKokQ7NYCi8mM30u683wqRbD?= =?us-ascii?q?VwqP6WACXWgQjxFFHhLK7BD+Xpf2ryv6qu9w0zSUMMHqUbw5Xymp4qF2QxHqlS?= =?us-ascii?q?gHLSY0/m/XhMJukaxVoxWvqBNjzIDbe4yVKPhzc7nBcd4AWWZNQMBcXDFBDIOm?= =?us-ascii?q?aIsPCvIMPOZXr4nnuVQOrga1CA6sBePg0D9HmHz20LYg3OQ8DQHG3RcgH84PsH?= =?us-ascii?q?vIrdX5LqASUfq6zKTRyzjIcvBY2S/l5YTVcB0souuAUa9yfMfR00UjCgzIg1qK?= =?us-ascii?q?pYD7Pj6Y0PkGvXKB4Op6T+2vjnYqqwFvrTirwcchkofJhpgPxVDL7yV22oA1JN?= =?us-ascii?q?yiR0JhYN6kFoVQuD+BN4tqQ8MtX2BotDw9yr0ctp63ZCkKyJI5yB7Dc/GLboqF?= =?us-ascii?q?7xH5WOqMIzp1hGhpdK+wihu960Ss1OzxWtGx0FlQrypFltfMtmoK1xzW8sWGSv?= =?us-ascii?q?R9/l2/1jaMzA3c8PxEIVw1larAN54hw6I/lpsJvUTEBC/2l136jLWKeUU85uio?= =?us-ascii?q?9+Pnb636qZCGMo90jhjyMqAvmsykHeQ1KRMOXmie+eSkzrLv50z5QLNQjv03iK?= =?us-ascii?q?bVqp7aJd5I7pK+VgRc14Jm7xekEx+n1s4ZlD8JNgFrYhWC2pnmIVzNaKTpAu2y?= =?us-ascii?q?gHyljStq3OzHNbynBY/CeCuQ2Iz9dKpwvhYPgDE4yspSsspZ?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0D9AQByT1tZmBqQr7JcHgYMGQYMhR+4C?= =?us-ascii?q?YYqgnZDFAEBAQEBAQEBAQEBEgEBAQEBCAsLBhsNL4IzIoJFBDsGAQE4BB8YNIs?= =?us-ascii?q?IDK9PgxGDBwEBBYhkCIMng0uKPIUoiWKHdI0zgWWBHogIiGwNg3GHM4Z6lTI2g?= =?us-ascii?q?SuBAghJhQQfghJWiSoBAQE?= X-IPAS-Result: =?us-ascii?q?A0D9AQByT1tZmBqQr7JcHgYMGQYMhR+4CYYqgnZDFAEBAQE?= =?us-ascii?q?BAQEBAQEBEgEBAQEBCAsLBhsNL4IzIoJFBDsGAQE4BB8YNIsIDK9PgxGDBwEBB?= =?us-ascii?q?YhkCIMng0uKPIUoiWKHdI0zgWWBHogIiGwNg3GHM4Z6lTI2gSuBAghJhQQfghJ?= =?us-ascii?q?WiSoBAQE?= X-IronPort-AV: E=Sophos;i="5.40,307,1496095200"; d="scan'208";a="230349138" Received: from fragranza.investici.org ([178.175.144.26]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jul 2017 10:21:28 +0200 Received: from [178.175.144.26] (fragranza [178.175.144.26]) (Authenticated sender: ygrek@autistici.org) by localhost (Postfix) with ESMTPSA id DA6E52C00AA for ; Tue, 4 Jul 2017 08:21:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1499156485; bh=gBnNbQthgLfpF5laGdwIHRblzoiKQfASPe9jQAelOQo=; h=Date:From:To:Subject; b=SHwg/rtGo5o0LDBrvONqLeI78Dn6opfS7Mq5vA1o/+TqDsOEP1d6Zu42P2We/wpKd Kf+vfwGoArZZAcpBfghA9QbRCKVGOw0hyf6oupcc0ShKFC95sx1Ag2ZCup3WAFAVlp yQ/V71w6R+N74xvDBITY+lJ+31q3GLKUlvBGTV1E= Date: Tue, 4 Jul 2017 01:21:22 -0700 From: ygrek To: caml-list@inria.fr Message-ID: <20170704012122.71fe4a55@kiwi.local.tld> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [Caml-list] They have different arities Hello, Consider the following : ``` # type t' = int option;; type t' = int option # type t = int option = None | Some of int;; Characters 0-40: type t = int option = None | Some of int;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This variant or record definition does not match that of type int option They have different arities. ``` What is the reasoning behind this error? I was expecting "specialisation" (in C++ terms), i.e. after `'a` in `'a option` was substituded for `int` - type is now 0-arity and equality should hold - there is no "free" arity left.. I gather that in case of `t'` it is type abbreviation and for `t` it is a re-export. The manual says : > Re-exported variant type or record type: an equation, a representation. > In this case, the type constructor is defined as an abbreviation for the type expression given in the equation, but in addition the constructors or fields given in the representation remain attached to the defined type constructor. The type expression in the equation part must agree with the representation: it must be of the same kind (record or variant) and have exactly the same constructors or fields, in the same order, with the same arguments. So it seems as long as representation matches - `t` should behave the same as abbreviation `t'`. PS The real-world usage for this involves a bigger type and a need to define serialization function for a "specialized" type outside of module with generic definition, hence the requirement to explicitly list constructors by re-exporting, but type has to be monomorphic. --