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 49A4D7EF28 for ; Fri, 26 Jun 2015 15:09:19 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of kennethadammiller@gmail.com) identity=pra; client-ip=209.85.218.45; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="kennethadammiller@gmail.com"; x-sender="kennethadammiller@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of kennethadammiller@gmail.com designates 209.85.218.45 as permitted sender) identity=mailfrom; client-ip=209.85.218.45; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="kennethadammiller@gmail.com"; x-sender="kennethadammiller@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-oi0-f45.google.com) identity=helo; client-ip=209.85.218.45; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="kennethadammiller@gmail.com"; x-sender="postmaster@mail-oi0-f45.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AZAwDXTY1VlC3aVdFbg2VfBoMYqwGEQooYghmFeAKBOQdMAQEBAQEBEgEBAQEHCwsJHzCEIgEBAQMBEhEdARsSCwEDAQsGBQsDCg0dAgIiAREBBQEKEgYTEhCHdwEDCggNrAk+MYs/gWuCeYshChknAwpXhRwBAQEBAQEBAQIBAQEBAQEBARQBBQ6LPIUCBAeCaIFDBYVaCo4ghFiGeoE6QpJgghESI4ENCREGhCUiMYJIAQEB X-IPAS-Result: A0AZAwDXTY1VlC3aVdFbg2VfBoMYqwGEQooYghmFeAKBOQdMAQEBAQEBEgEBAQEHCwsJHzCEIgEBAQMBEhEdARsSCwEDAQsGBQsDCg0dAgIiAREBBQEKEgYTEhCHdwEDCggNrAk+MYs/gWuCeYshChknAwpXhRwBAQEBAQEBAQIBAQEBAQEBARQBBQ6LPIUCBAeCaIFDBYVaCo4ghFiGeoE6QpJgghESI4ENCREGhCUiMYJIAQEB X-IronPort-AV: E=Sophos;i="5.13,684,1427752800"; d="scan'208";a="167462006" Received: from mail-oi0-f45.google.com ([209.85.218.45]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 26 Jun 2015 15:09:18 +0200 Received: by oiax193 with SMTP id x193so74802257oia.2; Fri, 26 Jun 2015 06:09:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=KensfHzso5PksWE0CM7c1ENYPu6et7EF2FW+rkWay/k=; b=GRTVOKFEtqADXNSoUDvUnT/Ta4TznXeO4vJ65B01cC3+1C6P+Tu2TAd1Y8LgRjJwDt m5uKZf8p0Rtw85N/pzsuLKq+ECVlmfSPB1GTCSmKp8BXhZ0ZlRgj+nDF5zAQlSWRUobW p+VSL1/Pv1a/7GebGpUdO3puLnIL277EAwivxZlCICZiaQbSiTVTUqDbaa8enPyV7ffw RQ8Doujm213NmCsMsySLf/ojqdssGwCyMSrmZh3C0vyaUmPT7s8C0EfqAZLzp7BRtCPq wy42USZfEWtFU7S9CnJ7PUg3zdZRYiY9jp3JQ4yqmNTJJHa4y7iFSUsPHg3JcR84tBag ACqw== MIME-Version: 1.0 X-Received: by 10.182.87.137 with SMTP id ay9mr43845458obb.68.1435324157114; Fri, 26 Jun 2015 06:09:17 -0700 (PDT) Received: by 10.202.191.8 with HTTP; Fri, 26 Jun 2015 06:09:17 -0700 (PDT) In-Reply-To: References: <558BB3F4.4050209@inria.fr> Date: Fri, 26 Jun 2015 09:09:17 -0400 Message-ID: From: Kenneth Adam Miller To: Ben Millwood Cc: Francois Berenger , caml users Content-Type: multipart/alternative; boundary=089e0111c01a85e3e705196b72ca Subject: Re: [Caml-list] Core Overlay --089e0111c01a85e3e705196b72ca Content-Type: text/plain; charset=UTF-8 I was reading compiler output and seeing that at times it would say things like xyz Core.Std.list = xyz list; I thought that was likely the case, and instances seemed interchangeable to the functions they get called on. But I wondered if there were some catch, as in the Core.Std.List type actually extends the pervasives list, or some subtlety that I missed. Thanks for that tidbit of information :) I got the rest of it refactored, and the core related stuff compiles. Now I'm just dealing with module interdependency issues. On Fri, Jun 26, 2015 at 2:34 AM, Ben Millwood wrote: > Core does not have its own list type, only its own list functions. ['a > Core.Std.List.t] is equal to ['a list], and the compiler only tells you one > or the other based on its heuristics for what would be most useful for you > to hear (which can't be right every time). > > Opening Core.Std at the beginning of your program is still the recommended > way to use Core, but you can also do something less invasive like just > using Core.Std.List.map directly. You may also find it useful that Core's > List.map takes a named argument ~f, whereas the standard List.map can't do > that (although ListLabels.map can). > > On 25 June 2015 at 08:55, Francois Berenger > wrote: > >> Just an idea, maybe you can put 'open Core.Std' (I'm not sure that's >> anymore the correct way to use Core but ...) on top of each >> ml file of the project, then try to recompile it like that. >> >> I guess you will then have many compilation errors that >> will force you to fix code to use Core's version of everything. >> After that, very few non tail rec. functions should remain >> in the code base. >> >> >> On 06/24/2015 06:02 PM, Kenneth Adam Miller wrote: >> >>> I'm trying to upgrade a library that has a lot of existing code that >>> makes calls to List.map; the core overlay is really nice, and I'd like >>> to make use of a tail recursive implementation because that much is >>> pretty much imperative. >>> >>> I've refactored the code of the library to make sure that the compiler >>> identifies the list and the operation types being from Core.List, >>> recompiled, opam pinned the project. But I keep getting blowups. I've >>> executed the code in gdb, and gotten a backtrace with the stack overflow >>> and I can see that it's still going to List.map. >>> >>> So I'm thinking it has to be one of a few errors: >>> >>> I've fixed it, but it's linking against a different, older version of >>> the library. >>> * Problem with this is, the makefile generates ocamlfind calls, and >>> those resolve the package correctly. I've check the file dates, removed >>> the packages and readded them a multi-tude of times. Unless there's some >>> invisible /usr/local compiler selection over the opam stuff despite it >>> being specifically pointed there, I don't see how this could be. But I >>> could be wrong. >>> >>> I've fixed the library some, but it some how resolves to a Pervasives >>> type that's not tail recursive somewhere in the library that I missed. >>> * I still don't see how this could be. I'm looking in the gdb backtrace, >>> and I can see where it flows from my code into the library-the library. >>> I've tracked the naming convention down to the exact function definition >>> and checked via Emacs Merlin that it's the type it should be. >>> >>> >>> I've fixed the library correctly, but somehow a mismatch between >>> pervasives and Core definitions causes some fallback to the pervasives >>> via some kind of invisible typing rules or language specifics that I >>> don't know about. >>> * Maybe, but wouldn't the compiler complain if it expected a >>> Core.Std.List.t and got a list instead? >>> >> >> -- >> Regards, >> Francois. >> "When in doubt, use more types" >> >> -- >> Caml-list mailing list. Subscription management and archives: >> https://sympa.inria.fr/sympa/arc/caml-list >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> Bug reports: http://caml.inria.fr/bin/caml-bugs >> > > --089e0111c01a85e3e705196b72ca Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I was reading compiler output and seeing that at times it = would say things like xyz Core.Std.list =3D xyz list; I thought that was li= kely the case, and instances seemed interchangeable to the functions they g= et called on. But I wondered if there were some catch, as in the Core.Std.L= ist type actually extends the pervasives list, or some subtlety that I miss= ed. Thanks for that tidbit of information :)

I got the r= est of it refactored, and the core related stuff compiles. Now I'm just= dealing with module interdependency issues.=C2=A0

On Fri, Jun 26, 2015 at 2:34 A= M, Ben Millwood <bmillwood@janestreet.com> wrote:
=
Core does not have its own = list type, only its own list functions. ['a Core.Std.List.t] is equal t= o ['a list], and the compiler only tells you one or the other based on = its heuristics for what would be most useful for you to hear (which can'= ;t be right every time).

Opening Core.Std at the beginni= ng of your program is still the recommended way to use Core, but you can al= so do something less invasive like just using Core.Std.List.map directly. Y= ou may also find it useful that Core's List.map takes a named argument = ~f, whereas the standard List.map can't do that (although ListLabels.ma= p can).

On 25 June 2015 at 08:55, Francoi= s Berenger <francois.berenger@inria.fr> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px= #ccc solid;padding-left:1ex">Just an idea, maybe you can put 'open Cor= e.Std' (I'm not sure that's
anymore the correct way to use Core but ...) on top of each
ml file of the project, then try to recompile it like that.

I guess you will then have many compilation errors that
will force you to fix code to use Core's version of everything.
After that, very few non tail rec. functions should remain
in the code base.


On 06/24/2015 06:02 PM, Kenneth Adam Miller wrote:
I'm trying to upgrade a library that has a lot of existing code that
makes calls to List.map; the core overlay is really nice, and I'd like<= br> to make use of a tail recursive implementation because that much is
pretty much imperative.

I've refactored the code of the library to make sure that the compiler<= br> identifies the list and the operation types being from Core.List,
recompiled, opam pinned the project. But I keep getting blowups. I've executed the code in gdb, and gotten a backtrace with the stack overflow
and I can see that it's still going to List.map.

So I'm thinking it has to be one of a few errors:

I've fixed it, but it's linking against a different, older version = of
the library.
* Problem with this is, the makefile generates ocamlfind calls, and
those resolve the package correctly. I've check the file dates, removed=
the packages and readded them a multi-tude of times. Unless there's som= e
invisible /usr/local compiler selection over the opam stuff despite it
being specifically pointed there, I don't see how this could be. But I<= br> could be wrong.

I've fixed the library some, but it some how resolves to a Pervasives type that's not tail recursive somewhere in the library that I missed.<= br> * I still don't see how this could be. I'm looking in the gdb backt= race,
and I can see where it flows from my code into the library-the library.
I've tracked the naming convention down to the exact function definitio= n
and checked via Emacs Merlin that it's the type it should be.


I've fixed the library correctly, but somehow a mismatch between
pervasives and Core definitions causes some fallback to the pervasives
via some kind of invisible typing rules or language specifics that I
don't know about.
* Maybe, but wouldn't the compiler complain if it expected a
Core.Std.List.t and got a list instead?

--
Regards,
Francois.
"When in doubt, use more types"

--
Caml-list mailing list.=C2=A0 Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocam= l_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


--089e0111c01a85e3e705196b72ca--