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 DE82D7EF5E for ; Fri, 15 Jul 2016 22:25:13 +0200 (CEST) IronPort-PHdr: 9a23:FXpF0BX8t/ENJN2SgmCirvK/IJ/V8LGtZVwlr6E/grcLSJyIuqrYZhOHt8tkgFKBZ4jH8fUM07OQ6PG4HzBcqs/a7DgrS99lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUiv2OQc9HOnpAIma153xjLHqvcGPKFwT2HKUWvBbFF2OtwLft80b08NJC50a7V/3mEZOYPlc3mhyJFiezF7W78a0+4N/oWwL46pyv+YJa6jxfrw5QLpEF3xmdjltvIy4/SXEGCmC/HYZQy0nmx5MBBCNuADzWpP2qgP1s+N83G+ROsigHp4uXjH33qB3QRqgoi4dMTkouDXGjdB5iahSuhSmtjRwxofVZMeeM/8oLfCVRs8TWWcUBpUZbCdGGI7pKtJXV+c= Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=yotambarnoy@gmail.com; spf=Pass smtp.mailfrom=yotambarnoy@gmail.com; spf=None smtp.helo=postmaster@mail-yw0-f177.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of yotambarnoy@gmail.com) identity=pra; client-ip=209.85.161.177; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="yotambarnoy@gmail.com"; x-sender="yotambarnoy@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of yotambarnoy@gmail.com designates 209.85.161.177 as permitted sender) identity=mailfrom; client-ip=209.85.161.177; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="yotambarnoy@gmail.com"; x-sender="yotambarnoy@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-yw0-f177.google.com) identity=helo; client-ip=209.85.161.177; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="yotambarnoy@gmail.com"; x-sender="postmaster@mail-yw0-f177.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AqAQD+RYlXhrGhVdFdhBR8qReHR4oTIoV4AoEvOxEBAQEBAQEBAREBAQEICwsJIS+CMgQBEgGCEgEBBAESER0BGx0BAwELBgUYAgImAgIhAhEBBQEcBhMbB4dzAQMPCA6ibYExPjGLO4FqgloFhFgKGScNUoNIAQEBAQEFAQEBARsCBhBxhSmETYJDgVkBgySCWgWYbTSGE4YxkUyIIoY6MIEPNII8gXMgMoY0ASWBHgEBAQ X-IPAS-Result: A0AqAQD+RYlXhrGhVdFdhBR8qReHR4oTIoV4AoEvOxEBAQEBAQEBAREBAQEICwsJIS+CMgQBEgGCEgEBBAESER0BGx0BAwELBgUYAgImAgIhAhEBBQEcBhMbB4dzAQMPCA6ibYExPjGLO4FqgloFhFgKGScNUoNIAQEBAQEFAQEBARsCBhBxhSmETYJDgVkBgySCWgWYbTSGE4YxkUyIIoY6MIEPNII8gXMgMoY0ASWBHgEBAQ X-IronPort-AV: E=Sophos;i="5.28,369,1464645600"; d="scan'208";a="226833999" Received: from mail-yw0-f177.google.com ([209.85.161.177]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 15 Jul 2016 22:25:13 +0200 Received: by mail-yw0-f177.google.com with SMTP id w127so112888664ywf.3 for ; Fri, 15 Jul 2016 13:25:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:from:mime-version:in-reply-to:date:message-id:subject:to :cc; bh=F1lGaVfyV8KhAATG/FdXdWck/3EJTN6OY1j/+/RN4ys=; b=Qrz8Px6KEDQ7blCUSv+wRjQ1AlJQ3W200+242gTC47iHU1PUdNNbwCJosC8ItmXl/a GpyWdJpSdFcMSgOGlu35giHa6R3UDGcALZ5g6DXzTQHzJK/AKgPVOAne93Hrpx9oAnd3 FHdTPkMDio2xG4jLuVB3bYcfWu/GkUzDqI7K/yLN49P3l4pF5MQ9q+fW1kq+tAvqmLIm s5jbgfPlR/ljjHIY0gPq0K444swH1tQOeHI/C659XkqqlG2gi3eSogfE2mRRTxSruYtk WFpGn9I3AJwEn3QTzjCRxYZq/5E+gmqdIrk4MeNi+HMWItL+RRS27ggK5OV5xrMtCZ8I h/bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:references:from:mime-version:in-reply-to:date :message-id:subject:to:cc; bh=F1lGaVfyV8KhAATG/FdXdWck/3EJTN6OY1j/+/RN4ys=; b=NeyII3mBMn5nGoGxtKh23T0UMXGTjTyfy0LV2oIKtJY3pCPc0WYS8L25C8w14hq1Vh RFOwHkytip9YXSTi1/1drR5NsoBw1lSJiKsyB/YeVyAIP7AGiQS5ziKeJgIRDXvLa1xZ SEcTZIC2q8a5FGjvm1pcm3y7yXYD0oIMjk5L3NCEB2xyt/Yo6syMHdn4b5fdWerNxSC2 Q3ldnXgqLn7GUZvyTpwyVAtRtvBnKWXrgQyniPjGePyO72zDXobXZlmagphxcIlfV7Qp Hu286M6Zp4RkBnIO+akSgaHUJXmfmoGJdX5qzY3mcnH056iSOWNksrgR5CV/0+cxindz qXXw== X-Gm-Message-State: ALyK8tJVAWZFWehbvrqbrVrAxY/ws7oWdLvv9SPcJB1/jMrWz4kYb2jAH4hsj23J9YDPXqSXU+ALiVvlh5Dqsw== X-Received: by 10.13.196.71 with SMTP id g68mr14965378ywd.155.1468614311385; Fri, 15 Jul 2016 13:25:11 -0700 (PDT) References: <001701d1daa2$30f7ac30$92e70490$@metastack.com> <1468179914.25014.89.camel@e130.lan.sumadev.de> <20160714090300.GB21053@frosties> <002601d1de7e$9f5776d0$de066470$@metastack.com> <20160715161308.GB30333@topoi.pooq.com> <6650375677998504317@unknownmsgid> <-1959624052697932351@unknownmsgid> From: Yotam Barnoy Mime-Version: 1.0 (1.0) In-Reply-To: Date: Fri, 15 Jul 2016 16:25:10 -0400 Message-ID: <-5973449789047308640@unknownmsgid> To: Jeremy Yallop Cc: "Hezekiah M. Carty" , Hendrik Boom , Ocaml Mailing List Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] Warnings opening modules (was: why is building ocaml hard?) That's right -- I haven't touched our Haskell code in a while and forgot about this detail. It's nice to know that this is possible in ocaml, but it's clearly inadequate for manually importing constructors. Perhaps this aspect (importing constructors) should be improved, since the others can be emulated. Or maybe open should be enhanced. While thinking about open, it would also be nice to think of similarly adequate solutions for modules that aren't opened but are still limited to a specific interface (qualified importing in Haskell). A solution that covers both cases with minimal changes would obviously be ideal. > On Jul 15, 2016, at 3:52 PM, Jeremy Yallop wrote: > >> On 15/07/2016, Yotam Barnoy wrote: >>> On Jul 15, 2016, at 3:26 PM, Hezekiah M. Carty wrote: >>> On Fri, Jul 15, 2016 at 2:58 PM Yotam Barnoy wrote: >>>>>> On Jul 15, 2016, at 2:09 PM, Jeremy Yallop wrote: >>>>>> On 15 July 2016 at 17:57, Yotam Barnoy wrote: >>>>>> In haskell, I can just say 'import A (foo, bar, baz, t)' to limit >>>>>> exactly what I want to import. This is because haskell has a >>>>>> half-baked module system that isn't nearly as powerful as OCaml's, >>>>>> which allows it to create syntax that doesn't need to go anywhere but >>>>>> at the toplevel. >>>>>> >>>>>> We need this functionality in OCaml, but the closest thing is to say >>>>>> 'include struct let foo = A.foo let bar = A.bar let baz = A.baz type t >>>>>> = A.t end' >>>>> >>>>> This can be written more succinctly: >>>>> >>>>> let foo, bar, baz = A.(foo, bar, baz) >>>>> type t = A.t >>>> >>>> Ok I have to admit that's pretty convenient. >>> type t = M.t does not bring M.t's constructors into scope. ppx_import ( >>> https://github.com/whitequark/ppx_import) can help with this if you don't >>> mind preprocessing. >> >> That's a great point. Without that last bit of functionality, this isn't >> really a solution to the problem. > > The Haskell example you gave: > > import A(T) > > doesn't bring T's constructors into scope, either; it needs to be > written like this: > > import A(T(..)) > > In OCaml you can bring A.t's constructors into scope by repeating the > definition: > > type t = A.t = T of int