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 6FA257F168 for ; Thu, 27 Aug 2015 15:30:15 +0200 (CEST) IronPort-PHdr: 9a23:cG/erx18aU4r5qqdsmDT+DRfVm0co7zxezQtwd8ZsegeK/ad9pjvdHbS+e9qxAeQG96LsLQa16GI6+jJYi8p39WoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6kO74TNaIBjjLw09fr2zQd6JyZrrnL7qs7ToICx2xxOFKYtoKxu3qQiD/uI3uqBFbpgL9x3Sv3FTcP5Xz247bXianhL7+9vitMU7q3cYk7sb+sVBSaT3ebgjBfwdVWx+cjN92Mq+khLKSA/Hw3IdVmQQnVJsAhPZpEXxV5L19y/7rfZV2S+APMSwQ6piChq46KI+eRj0gSJPHTcj9mbGwphhi75SpRiovRp40qbbZYiUMLx1eaaLLoBSfnZIQssED38JOYi7dYZaSrNZZes= 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-yk0-f174.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.160.174; 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.160.174 as permitted sender) identity=mailfrom; client-ip=209.85.160.174; 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-yk0-f174.google.com) identity=helo; client-ip=209.85.160.174; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="yotambarnoy@gmail.com"; x-sender="postmaster@mail-yk0-f174.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DCAQD2D99VnK6gVdFdhFgGgx2vA5R3BzsRAQEBAQEBAQEQAQEBAQEGDQkJIS6CHYIfER0BGx4DEgkBBjcCJAERAQUBIjWHdgEDEqNFggWBLz4xi0CBbIJ5iikKGScNVoR/AQUOk06BQwWVPXCMA5kUEiOBFxeEKiIzgk0BAQE X-IPAS-Result: A0DCAQD2D99VnK6gVdFdhFgGgx2vA5R3BzsRAQEBAQEBAQEQAQEBAQEGDQkJIS6CHYIfER0BGx4DEgkBBjcCJAERAQUBIjWHdgEDEqNFggWBLz4xi0CBbIJ5iikKGScNVoR/AQUOk06BQwWVPXCMA5kUEiOBFxeEKiIzgk0BAQE X-IronPort-AV: E=Sophos;i="5.17,422,1437429600"; d="scan'208";a="175066480" Received: from mail-yk0-f174.google.com ([209.85.160.174]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 27 Aug 2015 15:30:14 +0200 Received: by ykbi184 with SMTP id i184so19316220ykb.2 for ; Thu, 27 Aug 2015 06:30:13 -0700 (PDT) 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=SfJR60A/9Ot71EDQ6ECQaAcjt4IglvduMwY/BGjvtmg=; b=UbW6e8MqIHAKt6eF/6uDXGj9kcoQPyDnK/CU5Maiuk5auvGGYDECLpNNLNdC5vTtTg kkkThpRU5ktF/4x4Fk/cGUTHBRVvGkEbMO3PGf8CfogvzgXO2+h2X/ylUatCdwOJ1LMn JHl3nwC1Z2Wz0gTROYpEY7BW4LroIRtM07Pm7qiH68DbJ3vQUWzNXyggcGfiuivXVdac MC0xg8DqtzfCik37OaW/cLEqEuJb2MLyJ/yB5ep4sZNEPU8o/pM7FAf4wMKZ1yXn4T0Q yhq6iQBkytFqMDgXjnXAxRBF+v7+27DVHQPS2tolxRpcFdPCOmV7YJNSQpe0EXcNRXpj nNwA== X-Received: by 10.170.146.213 with SMTP id n204mr3249764ykc.104.1440682213589; Thu, 27 Aug 2015 06:30:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.202.206 with HTTP; Thu, 27 Aug 2015 06:29:54 -0700 (PDT) From: Yotam Barnoy Date: Thu, 27 Aug 2015 09:29:54 -0400 Message-ID: To: Ocaml Mailing List Content-Type: multipart/alternative; boundary=001a1139fa88934cdc051e4af778 Subject: [Caml-list] Expanding functors --001a1139fa88934cdc051e4af778 Content-Type: text/plain; charset=UTF-8 One problem I've commonly encountered in OCaml is the inability to expand the interface of functors after they've been created (I'm not talking about post-application). For example, Map.Make in the stdlib takes an OrderedType module which contains only the compare function. What happens if I want to add something to this interface, such as a show function? I have to copy the whole implementation of Map.Make into my own file to modify it. Compare this to the ability to 'include' a regular module and just add the new functionality, and to take the type of a module and expand that type as needed. Functors are severely lacking in this regard. What do people think of this idea -- of allowing functors to be expanded? Ideally, expanding a functor would allow for both replacing its argument type (as in the example I gave) and for adding a second/third functor argument type (so Map.Make(OrderedType) would become Map.Make(OrderedType)(Show). -Yotam --001a1139fa88934cdc051e4af778 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
One problem I've commonly encountered in OCaml is the = inability to expand the interface of functors after they've been create= d (I'm not talking about post-application). For example, Map.Make in th= e stdlib takes an OrderedType module which contains only the compare functi= on. What happens if I want to add something to this interface, such as a sh= ow function? I have to copy the whole implementation of Map.Make into my ow= n file to modify it. Compare this to the ability to 'include' a reg= ular module and just add the new functionality, and to take the type of a m= odule and expand that type as needed. Functors are severely lacking in this= regard.=C2=A0

What do people think of this idea --= of allowing functors to be expanded? Ideally, expanding a functor would al= low for both replacing its argument type (as in the example I gave) and for= adding a second/third functor argument type (so Map.Make(OrderedType) woul= d become Map.Make(OrderedType)(Show).

-Yotam=
--001a1139fa88934cdc051e4af778--