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 3F0FA7F616 for ; Fri, 24 Feb 2017 10:16:56 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=tom.j.ridge@googlemail.com; spf=Pass smtp.mailfrom=tom.j.ridge@googlemail.com; spf=None smtp.helo=postmaster@mail-oi0-f49.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of tom.j.ridge@googlemail.com) identity=pra; client-ip=209.85.218.49; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="tom.j.ridge@googlemail.com"; x-sender="tom.j.ridge@googlemail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of tom.j.ridge@googlemail.com designates 209.85.218.49 as permitted sender) identity=mailfrom; client-ip=209.85.218.49; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="tom.j.ridge@googlemail.com"; x-sender="tom.j.ridge@googlemail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-oi0-f49.google.com) identity=helo; client-ip=209.85.218.49; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="tom.j.ridge@googlemail.com"; x-sender="postmaster@mail-oi0-f49.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3Ah6Oe2xKKVr3WQ1ZFHtmcpTZWNBhigK39O0sv0rFi?= =?us-ascii?q?tYgRI/nxwZ3uMQTl6Ol3ixeRBMOAuq8C0rud6vu9EUU7or+5+EgYd5JNUxJXwe?= =?us-ascii?q?43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRp?= =?us-ascii?q?OOv1BpTSj8Oq3Oyu5pHfeQtFiT69bL9oMRm7qQrdutQYjIZiN6081gbHrnxUdu?= =?us-ascii?q?pM2GhmP0iTnxHy5sex+J5s7SFdsO8/+sBDTKv3Yb02QaRXAzo6PW814tbrtQTY?= =?us-ascii?q?QguU+nQcSGQWnQFWDAXD8Rr3Q43+sir+tup6xSmaIcj7Rq06VDi+86tmTgLjhT?= =?us-ascii?q?wZPDAl7m7Yls1wjLpaoB2/oRx/35XUa5yROPZnY6/RYc8WSW9HU81MVSJOH5m8?= =?us-ascii?q?YpMNAOoPPehWoYrzqUYQoxSiHgSjHv/jxyVSi3PqwaE30eIsGhzG0gw6GNIOtW?= =?us-ascii?q?zZosvyNKcXTOu70KjIwijMb/xIxDzw75TIchckof2WX7J8a9DRyUgyGAPKkFqc?= =?us-ascii?q?rojlPzKO1uQRqGWb4O1gVeWgi24jtQ5xpyKgxsYoioXTmo0VzVXE+Dx/zY0oJt?= =?us-ascii?q?O4UFZ2bcC4HJZUrS2XNIt7Ttk8T211uys20LILtJq9cSMX0poo3QTfZOaCc4WQ?= =?us-ascii?q?4hLsSuKRITBgiXJgYr2/hhKy/VGnyu39SsW4yVhKoyVBn9XWuXAN0BvT6seDSv?= =?us-ascii?q?Rj5EuuxTGP1wXL5uFFJ0A7i7bbJoY/zrIskpcfq0fOEy/slEnokaObdV8o9+es?= =?us-ascii?q?5uj/Z7XpvJ6cN4t6igHkNaQun9SyAfg/MggLRWSb+/6w1Kfi/ULkT7VFkOY7kq?= =?us-ascii?q?besJDdKsQborC2AwpP3YYi7xazFSup0NMdnXUfNlJKZAqHj5T1O1HJOP33Ee2w?= =?us-ascii?q?g1GokDtyw/DGP6bhAonWI3jYkLbheK595FRGxAoyy9Bf/ZNUBasbLPL9QE+i/O?= =?us-ascii?q?DfWz4nOgr87OH7D8t21oICQirbA7GWGKLfvFLO4fggdbqifogQ7Qr6LrAf5vLh?= =?us-ascii?q?gDdthVgYO6vvx5obZ337GvV9P22WZn3jhtoEGGYO+AE5Sbq52xW5TTdPaiPqDO?= =?us-ascii?q?oH7TYhBdfjVN+bSw=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0A1AACs+K9YhjHaVdFdGQEBAQEBAQEBA?= =?us-ascii?q?QEBBwEBAQEBFAEBAQEBAQEBAQEBBwEBAQEBhQ8Hg1SKCJFgkAmFLItQBz8YAQE?= =?us-ascii?q?BAQEBAQEBAQESAQEBCAsLCh0vgjMiAYIaAQEEASMEGQE4AQMBCwEFBQsDCioCA?= =?us-ascii?q?iISAQUBHAYTiVsBAw0IoFQ/jAOBbDqDCQWDYQoZJw2DfwELHgIGEospglGFCYJ?= =?us-ascii?q?fBY9PjEuSJZEWkWYUHoEVH4E4EhAPBB9TF4JbgUqCDUA1AYooAQEB?= X-IPAS-Result: =?us-ascii?q?A0A1AACs+K9YhjHaVdFdGQEBAQEBAQEBAQEBBwEBAQEBFAE?= =?us-ascii?q?BAQEBAQEBAQEBBwEBAQEBhQ8Hg1SKCJFgkAmFLItQBz8YAQEBAQEBAQEBAQESA?= =?us-ascii?q?QEBCAsLCh0vgjMiAYIaAQEEASMEGQE4AQMBCwEFBQsDCioCAiISAQUBHAYTiVs?= =?us-ascii?q?BAw0IoFQ/jAOBbDqDCQWDYQoZJw2DfwELHgIGEospglGFCYJfBY9PjEuSJZEWk?= =?us-ascii?q?WYUHoEVH4E4EhAPBB9TF4JbgUqCDUA1AYooAQEB?= X-IronPort-AV: E=Sophos;i="5.35,200,1484002800"; d="scan'208,217";a="214573014" Received: from mail-oi0-f49.google.com ([209.85.218.49]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 24 Feb 2017 10:16:54 +0100 Received: by mail-oi0-f49.google.com with SMTP id s205so7809215oif.3 for ; Fri, 24 Feb 2017 01:16:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=K0QTcC7Y9CMaibV3evxX+bSRMkTO5/MWG/TpMfzJPec=; b=QyLIc7l+CAFoZ5FynNnBF6Swb4bTs3PvtV+sVeqNJqBMn6n6YmittmQVVBF0JDHZaW Ww/cx7KHd2VhD6KI7G3Zttk7ZLPahKbHViKRs2DRY4Iy5hZK+i+0T4k4QFdij9PCGSOv JN8H/BPEmWa8F48oUyPytw+joPFh1Uwo3KX9DYEK8tCEuehAGGBsh3pW7kmmudbuk730 rwKHu1YYPzTb3If9rXhXBRvb6VWnAPKclROF9EGdibmmisXle3FSV3/UtXBKbnwZfcbD xLDSV3eXUYZoAgdjpKgL9VZtUAVHj+zL194/PuXzj66vJr4VpayaFu0XliIAs3TD/mRf Klqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=K0QTcC7Y9CMaibV3evxX+bSRMkTO5/MWG/TpMfzJPec=; b=KyqOtBnF2tHQOBJVAcB5dkkDUTwJ/lk7aPI3SNzNYNuY30WWspncqS2e28tw9CsuTW SX9qhVEjkhzaNAiYJUCquZ1+AJmBQeMdA3hmUo0yQUojX2BTVCdaEtnB3aRUlFfU3YXu afXoEbXSV9BSLSTsiLOaO8OFUIQZT0vLv2t/ohzb9Xil2U5IJqS1jDzzmQhiwTmG8XvO a/s4mG9f4vB3Susiy/l8q9DAaKdjgPZCvB8IRmYdBM4k7BpJBkK45r9LnUcBS3iUMJLJ Cf2zY1uMmKbkud8S+AmjU/buPGoNro8YhULCniphh+sE11FQtFG78j8QhGJzqShuWFKZ IubQ== X-Gm-Message-State: AMke39lVh+2Ee66XyyLQMMMtUnZZNiwaYKQ+WdDF553ZcjaSNvZ6OYt5qNhI/nvtO55kARSxoaPmeJtt2sZ5Cw== X-Received: by 10.202.3.197 with SMTP id 188mr948244oid.31.1487927813425; Fri, 24 Feb 2017 01:16:53 -0800 (PST) MIME-Version: 1.0 Sender: tom.j.ridge@googlemail.com Received: by 10.74.144.129 with HTTP; Fri, 24 Feb 2017 01:16:32 -0800 (PST) In-Reply-To: References: From: Tom Ridge Date: Fri, 24 Feb 2017 09:16:32 +0000 X-Google-Sender-Auth: -0GjGsGzwQdor61J7bm3hWASC-I Message-ID: To: Ivan Gotovchits Cc: caml-list Content-Type: multipart/alternative; boundary=001a113b7206c56cc905494330dc Subject: Re: [Caml-list] OCamldebug --001a113b7206c56cc905494330dc Content-Type: text/plain; charset=UTF-8 My functors never hide anything, and always include the input module as a submodule of the output module. So I hope that type equalities are as maximally visible as they could be. But ocamldebug doesn't seem to get it :( On 23 February 2017 at 17:02, Ivan Gotovchits wrote: > It matters whether in the signature of a module that is produced by the > functor, the type of the key is still the same as the type of the key > parameter. If it is not, then debugger cannot know, whether the output type > is a key or not. Probably, if you add a sharing constraint between the > functor parameter signature and the resulting module signature the debugger > with capture it. Especially, if this would be an erasing signature > (although it is not always possible), e.g., > > module M = sig type key type t end > module Make(Key : T) : M with type key = Key.t > > > or > > module Make(Key : T) : M with type key := Key.t > > > > If these approaches do not work for you, then you can define a printer > yourself in a separate module (that is loaded with `load_printer` command). > In this printer you may apply a functor, > and since functors are applicative in OCaml the debugger might be clever > enough to pick this printer. It is not guaranteed, though, as the debugger > is using lots of heuristics, and sometimes, they do fail. > > > Best wishes, > Ivan > > > > On Thu, Feb 23, 2017 at 11:49 AM, Tom Ridge com> wrote: > >> Regarding `#install_printer`, can you explain more? The type >> "Key_value_types.key" is equal to string (in this particular case). >> However, this type is produced via module application, and so I cannot >> construct a printer that can print values of type "Key_value_types.key" >> before program execution (which seems to be required for #install_printer). >> >> Somehow I seem to want to tell ocamldebug that Key_value_types.key is in >> fact equal to string. Or alternatively coerce kra (using Obj.magic) to >> string type so that it can easily be printed by ocamldebug? >> >> >> >> On 23 February 2017 at 16:31, Ivan Gotovchits wrote: >> >>> Probably it is an abstract type, that is represented as string. In any >>> case you can use the `#install_printer` directive to enable printing any >>> type. The argument >>> is a function of type `t -> Format.formatter -> unit`, where `t` is a >>> name of your type. >>> >>> On Thu, Feb 23, 2017 at 11:24 AM, Tom Ridge < >>> tom.j.ridge+list@googlemail.com> wrote: >>> >>>> Dear All, >>>> >>>> I am debugging some code. For various reasons I have started to use >>>> ocamldebug rather than printf. >>>> >>>> I should say that ocamldebug is excellent. Really excellent. Especially >>>> the "backwards" stepping. >>>> >>>> However, sometimes I want to see the value of a particular variable. I >>>> can use the "p" (print) command as: >>>> >>>> (ocd) p kra >>>> kra: Key_value_types.key = >>>> >>>> The problem is that I know that kra is a string. But ocamldebug only >>>> shows . >>>> >>>> Admittedly the code is functorized. But I have a feeling I should be >>>> able to tweak something to get ocamldebug to print the value of kra. >>>> >>>> Any ideas? >>>> >>>> T >>>> >>> >>> >> > --001a113b7206c56cc905494330dc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
My functors never hide anything, and always include the in= put module as a submodule of the output module. So I hope that type equalit= ies are as maximally visible as they could be. But ocamldebug doesn't s= eem to get it :(



On 23 February 2017 at 17:02, Ivan Gotov= chits <ivg@ieee.org> wrote:
It matters=C2=A0whether in the signature of a module tha= t is produced by the functor, the type of the key is still the same as the = type of the key parameter. If it is not, then debugger cannot know, whether= the output type is a key or not. Probably, if you add a sharing constraint= between the functor parameter signature and the resulting module signature= the debugger with capture it. Especially, if this would be an erasing sign= ature (although it is not always possible), e.g.,

module M = =3D sig type key type t end
module Make(Key : T) : M with type ke= y =3D Key.t

or

module M= ake(Key : T) : M with type key :=3D Key.t

=

If these approaches do not work for you, then you can d= efine a printer yourself in a separate module (that is loaded with `load_pr= inter` command). In this printer you may apply a functor,
and sin= ce functors=C2=A0are applicative in OCaml the debugger might be clever enou= gh to pick this printer. It is not guaranteed, though, as the debugger is u= sing lots of heuristics, and sometimes, they do fail.=C2=A0

<= /div>

Best wishes,
Ivan



On Thu, Feb 23, 2017 at 11:49 AM,= Tom Ridge <tom.j.ridge+list@googlemail.com> wrote:
Regarding `#i= nstall_printer`, can you explain more? The type "Key_value_types.key&q= uot; is equal to string (in this particular case). However, this type is pr= oduced via module application, and so I cannot construct a printer that can= print values of type "Key_value_types.key" before program execut= ion (which seems to be required for #install_printer).=C2=A0

=
Somehow I seem to want to tell ocamldebug that Key_value_types.key is = in fact equal to string. Or alternatively coerce kra (using Obj.magic) to s= tring type so that it can easily be printed by ocamldebug?



On 23 February 2017 at 16:31, Ivan Gotovchits <ivg@ieee.org> wrote:
Prob= ably it is an abstract type, that is represented as string. In any case you= can use the `#install_printer` directive to enable printing any type. The = argument
is a function of type `t -> Format.formatter=C2=A0-> uni= t`, where `t` is a name of your type.=C2=A0

On Thu, Feb 23, 2017 at 11:24 AM, Tom Ridge <t= om.j.ridge+list@googlemail.com> wrote:
Dear All,

I am debuggi= ng some code. For various reasons I have started to use ocamldebug rather t= han printf.

I should say that ocamldebug is excell= ent. Really excellent. Especially the "backwards" stepping.
=

However, sometimes I want to see the value of a particu= lar variable. I can use the "p" (print) command as:
(ocd) p kra
kra: Key_value_types.key =3D <abs= tr>

The problem is that I know that kra i= s a string. But ocamldebug only shows <abstr>.=C2=A0

Admittedly the code is functorized. But I have a feeling I should = be able to tweak something to get ocamldebug to print the value of kra.

Any ideas?
<= div>
T




--001a113b7206c56cc905494330dc--