From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id 51F497F1C9 for ; Sat, 10 Nov 2012 01:03:04 +0100 (CET) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of milanst@gmail.com) identity=pra; client-ip=209.85.160.54; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="milanst@gmail.com"; x-sender="milanst@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of milanst@gmail.com designates 209.85.160.54 as permitted sender) identity=mailfrom; client-ip=209.85.160.54; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="milanst@gmail.com"; x-sender="milanst@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-pb0-f54.google.com) identity=helo; client-ip=209.85.160.54; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="milanst@gmail.com"; x-sender="postmaster@mail-pb0-f54.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AroCAOKYnVDRVaA2k2dsb2JhbABEhhm9MQgjAQEBAQkJFBQEI4JIBBkBGx4DEhAPAiYCJAERAQUBFgyICgEDD5xagm+LY0+CeIRyChknDVmIdQEFDIEWkCmBEwOIWo0hjmIWKYQvgT8k X-IronPort-AV: E=Sophos;i="4.80,749,1344204000"; d="scan'208";a="161981728" Received: from mail-pb0-f54.google.com ([209.85.160.54]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 10 Nov 2012 01:03:03 +0100 Received: by mail-pb0-f54.google.com with SMTP id wz17so1920590pbc.27 for ; Fri, 09 Nov 2012 16:03:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=UuKmVs/wd8JfNMFlnVPhGGG4phkGtGcE2lS2tQmYWJI=; b=w8EDzbs57G79D8ZrkBfK7HLe8JDAWhHhV/BiFbvFNBmbLPrrfSP95MTqMxUouwMc9z SGeDtxLbDZKBVVpHJnwFL+VdIvxLc8LdQLUW48nyPLH0Qnfz94fUQmGxIT/0fAZdylFw DnzPvy9pCp/57kt5KEbbP/GiAlwPAlcH1Hd0G1IfzErDfnrakjpDhy6KT74e7QnR1nGL f7Q+Przk+I5MWlhjFTKBuZN3RWStjz4pkW3hi6SakkA68FvJEo4ipW9d+sOxCuX/OsP+ z14J2ORMwP1paqrYxrxjZ6BCL8IA2WHsbSuWX6dJ74PU0m774ERmYxYKyEfx7goyvujl 02YQ== Received: by 10.68.230.2 with SMTP id su2mr5537020pbc.54.1352505781364; Fri, 09 Nov 2012 16:03:01 -0800 (PST) MIME-Version: 1.0 Received: by 10.68.29.99 with HTTP; Fri, 9 Nov 2012 16:02:21 -0800 (PST) From: =?UTF-8?Q?Milan_Stanojevi=C4=87?= Date: Fri, 9 Nov 2012 19:02:21 -0500 Message-ID: To: Caml List Content-Type: text/plain; charset=UTF-8 Subject: [Caml-list] avoiding boilerplate with phantom types This is my use case. I have a module A with type t and bunch of functions. I want to create module B which is just a wrapper around A with a phantom type Roughly module A : sig type t val foo : t -> int val bar : t -> string end module B : sig type phantom1 type phantom2 type 'a t (* or maybe even type 'a t = private A.t *) val foo : _ t -> int val bar : _ t -> string val validate : phantom1 t -> phantom2 t end I was hoping I can avoid copy-pasting declarations and that I can have some easy way to have A and B in sync as I add or remove functions from A. I was able to do something for implementation B but not for interface. B.ml type this_name_is_not_in_scope = A.t include (A : module type of A with type t = this_name_is_not_in_scope) type 'a t = A.t type phantom1 type phantom2 let validate = .... But for interface I can't do anything unless I expose type equality between 'a B.t and A.t (which renders phantom types useless) so I had to list all the functions by hand. Does anyone have a better way to do this? The problem is that I can't say include module type of A with type t := 'a t Why is this disallowed? Thanks, Milan