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 615337F616 for ; Fri, 24 Feb 2017 10:21:11 +0100 (CET) Authentication-Results: mail2-smtp-roc.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-f43.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of tom.j.ridge@googlemail.com) identity=pra; client-ip=209.85.218.43; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="tom.j.ridge@googlemail.com"; x-sender="tom.j.ridge@googlemail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of tom.j.ridge@googlemail.com designates 209.85.218.43 as permitted sender) identity=mailfrom; client-ip=209.85.218.43; receiver=mail2-smtp-roc.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 (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-oi0-f43.google.com) identity=helo; client-ip=209.85.218.43; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="tom.j.ridge@googlemail.com"; x-sender="postmaster@mail-oi0-f43.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3A2vXe3RXpTUKJ7856YgakFfZg66HV8LGtZVwlr6E/?= =?us-ascii?q?grcLSJyIuqrYZhWCt8tkgFKBZ4jH8fUM07OQ6PG9HzVRqs/a7ThCKMUKDEBVz5?= =?us-ascii?q?1O3kQJO42sNw7SFLbSdSs0HcBPBhdO3kqQFgxrIvv4fEDYuXao7DQfSV3VPAtx?= =?us-ascii?q?IfnpSMaJ15zkn8j7wZDYYh1JiTyhevsyaUzu9USC/vUR1Kp8I6B55RzVpWVDe+?= =?us-ascii?q?VK3is8JEyctxfx68r2+4RspXd+ofUkovJHVO3Afqg3QPQMEDMjdWJz/sznuhSA?= =?us-ascii?q?SQqU+lMTVWIZlhdNCgnBqhr9W8Gi4WPBquNh1XzCboXNRrcuVGHntv8zRQ=3D?= =?us-ascii?q?=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0A1AACM+q9YhivaVdFdGQEBAQEBAQEBA?= =?us-ascii?q?QEBBwEBAQEBFAEBAQEBAQEBAQEBBwEBAQEBhQ8Hg1SKCJFgkAmFLItQBz8YAQE?= =?us-ascii?q?BAQEBAQEBAQESAQEBCAsLCh0vgjMEAR0BBIIWAQEEASMEGQE4AQMBCwEFBQsDC?= =?us-ascii?q?ioCAiISAQUBHAYTiVsBAw0IoFc/jAOBbDqDCQWDYQoZJw2DfwELHgIGEospglG?= =?us-ascii?q?FCYJfBY9PhhyGL5IlkRaRZhQegRUfgTgSEA8EH1MXgluBSoINQDUBiFmBTwEBA?= =?us-ascii?q?Q?= X-IPAS-Result: =?us-ascii?q?A0A1AACM+q9YhivaVdFdGQEBAQEBAQEBAQEBBwEBAQEBFAE?= =?us-ascii?q?BAQEBAQEBAQEBBwEBAQEBhQ8Hg1SKCJFgkAmFLItQBz8YAQEBAQEBAQEBAQESA?= =?us-ascii?q?QEBCAsLCh0vgjMEAR0BBIIWAQEEASMEGQE4AQMBCwEFBQsDCioCAiISAQUBHAY?= =?us-ascii?q?TiVsBAw0IoFc/jAOBbDqDCQWDYQoZJw2DfwELHgIGEospglGFCYJfBY9PhhyGL?= =?us-ascii?q?5IlkRaRZhQegRUfgTgSEA8EH1MXgluBSoINQDUBiFmBTwEBAQ?= X-IronPort-AV: E=Sophos;i="5.35,200,1484002800"; d="scan'208,217";a="261909050" Received: from mail-oi0-f43.google.com ([209.85.218.43]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 24 Feb 2017 10:21:09 +0100 Received: by mail-oi0-f43.google.com with SMTP id s205so7849170oif.3 for ; Fri, 24 Feb 2017 01:21:09 -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=51WsktN9lZw7vmRDoaa+U6qMJfl3nfgffj9PHd2RALM=; b=EzYOZSVF2761Zs8a19apAE7BrVcokbgv2FsMOrq8X/B2N+rcWSK+GJ5ws2lDA3sNyu JIbzVeXvAg2NLoWLqnb2ZWTQHehBseN6acvzv/rAoX1LfdG7lbN3DxHt4uldIfRK0BCJ +QK+4kNdIBH6CeSYFTfdvwNebI/uVgSxJuHJvulYlR7MVuMjWcHNBCCI1LDK8TqF/gq4 0sMMNp3wMQhKW+o9OxxB7W/G4WSN+mWLGhat7mdXFCaWYerW1vgjzZ/CANCFJ5BcHDri 3rr7KMyBUIfYWclLboF9RqDOgJcVyJdgqWxzk3EWPwRms/Kzva8OIABjZeZUuuAcNPqE 8rnw== 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=51WsktN9lZw7vmRDoaa+U6qMJfl3nfgffj9PHd2RALM=; b=lgYiCPDlBrXFNXUmV6I+1qEfL4vADJgf1+gcLcmgLA2KqLoXjMM9FMgkd7OmWU6QB0 hJrCUlKDjdfGeadVcYOS5F0+oAYp0yWHlyc6xXDEqMKJtyoBcsU5HC+JsrJO9lxaBCAW 7vkLhRi+QTS1zzKZ1cSFV1JftF7VQWlW9bTqmSeq93Ft4Ul/XgSX1dsbr2PeVlZboSJV N4YsP99PpkF/EzghfZ1GVQeO0enO9uxSRCXPiacdisnm6GT8+b7WNP0yCqfaI5S5ftLy j6lnTUXBB0IP0PmlFuc0lRijvwNF2OPqJMrKekyKulm8Z2iN1Fc0ZSEF6/05kMC1yjJo Z/pA== X-Gm-Message-State: AMke39nBRaHncVtPIZknaLFQL27N4f5h0GL/xHZYzMAxcB3F3fTsCtvF6jjN9IcmYq7ahC74yCAVfLeKVNK2kA== X-Received: by 10.202.7.193 with SMTP id 184mr842639oih.58.1487928068208; Fri, 24 Feb 2017 01:21:08 -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:20:47 -0800 (PST) In-Reply-To: References: From: Tom Ridge Date: Fri, 24 Feb 2017 09:20:47 +0000 X-Google-Sender-Auth: QrQe7YzWGXLGuPNHbaJIVdGmRIk Message-ID: To: Ivan Gotovchits Cc: caml-list Content-Type: multipart/alternative; boundary=94eb2c13e2e4f508fd0549433f47 Subject: Re: [Caml-list] OCamldebug --94eb2c13e2e4f508fd0549433f47 Content-Type: text/plain; charset=UTF-8 I take it back! Some of my code goes via external functors which indeed hide various type equalities. Thanks for your help. On 24 February 2017 at 09:16, Tom Ridge wrote: > 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 < >> tom.j.ridge+list@googlemail.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 >>>>> >>>> >>>> >>> >> > --94eb2c13e2e4f508fd0549433f47 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I take it back! Some of my code goes via external functors= which indeed hide various type equalities.

Thanks for y= our help.

On 24 February 2017 at 09:16, Tom Ridge <tom.j.ridge+l= ist@googlemail.com> wrote:
=
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 :(


<= div class=3D"h5">

= On 23 February 2017 at 17:02, Ivan Gotovchits <ivg@ieee.org> wrot= e:
It matters=C2=A0= whether in the signature of a module that is produced by the functor, the t= ype 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. P= robably, if you add a sharing constraint between the functor parameter sign= ature and the resulting module signature the debugger with capture it. Espe= cially, if this would be an erasing signature (although it is not always po= ssible), e.g.,

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

module Make(Key : T) : M with type key :=3D K= ey.t


If these approach= es do not work for you, then you can define a printer yourself in a separat= e module (that is loaded with `load_printer` command). In this printer you = may apply a functor,
and since functors=C2=A0are applicative in O= Caml the debugger might be clever enough to pick this printer. It is not gu= aranteed, though, as the debugger is using lots of heuristics, and sometime= s, they do fail.=C2=A0


Best wishes,=
Ivan



On Thu, Feb 23, 2017 at 11:= 49 AM, Tom Ridge <tom.j.ridge+list@googlemail.com&g= t; wrote:
Regardi= ng `#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 th= at can print values of type "Key_value_types.key" before program = execution (which seems to be required for #install_printer).=C2=A0

=
Somehow I seem to want to tell ocamldebug that Key_value_types.k= ey 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 Februa= ry 2017 at 16:31, Ivan Gotovchits <ivg@ieee.org> wrote:
Probably it is an abstract type, = that is represented as string. In any case you can use the `#install_printe= r` directive to enable printing any type. The argument
is a function of= type `t -> Format.formatter=C2=A0-> unit`, where `t` is a name of yo= ur type.=C2=A0

=
On Thu, Feb 23, 2017 at 11:24 AM, Tom Ridge <tom.j.ridge+list@googlemail.com> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px= #ccc solid;padding-left:1ex">
Dear All,

I am debugging some code. For various reasons I have started to use ocamld= ebug rather than printf.

I should say that ocamlde= bug is excellent. Really excellent. Especially the "backwards" st= epping.

However, sometimes I want to see the value= of a particular variable. I can use the "p" (print) command as:<= /div>

(ocd) p kra
kra: Key_value_types.ke= y =3D <abstr>

The problem is that I kn= ow that kra is a string. But ocamldebug only shows <abstr>.=C2=A0

Admittedly the code is functorized. But I have a feel= ing I should be able to tweak something to get ocamldebug to print the valu= e of kra.

Any ideas?

T
<= /div>





--94eb2c13e2e4f508fd0549433f47--