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 6022580043 for ; Tue, 18 Oct 2016 16:51:33 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=andre@digirati.com.br; spf=Pass smtp.mailfrom=andre@digirati.com.br; spf=Pass smtp.helo=postmaster@mta112.f1.k8.com.br Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of andre@digirati.com.br) identity=pra; client-ip=187.73.32.184; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="andre@digirati.com.br"; x-sender="andre@digirati.com.br"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of andre@digirati.com.br designates 187.73.32.184 as permitted sender) identity=mailfrom; client-ip=187.73.32.184; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="andre@digirati.com.br"; x-sender="andre@digirati.com.br"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of postmaster@mta112.f1.k8.com.br designates 187.73.32.184 as permitted sender) identity=helo; client-ip=187.73.32.184; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="andre@digirati.com.br"; x-sender="postmaster@mta112.f1.k8.com.br"; x-conformance=sidf_compatible; x-record-type="v=spf1" IronPort-PHdr: =?us-ascii?q?9a23=3AeBLsYx/vt0V8hf9uRHKM819IXTAuvvDOBiVQ1KB9?= =?us-ascii?q?0OgcTK2v8tzYMVDF4r011RmSDN+dtq4P1LqempujcFRI2YyGvnEGfc4EfD4+ou?= =?us-ascii?q?JSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47AblHf6ke/8SQVUk2mc1Ek?= =?us-ascii?q?fKKoRsWN34ye7KObw9XreQJGhT6wM/tZDS6dikHvjPQQmpZoMa0ryxHE8TNicu?= =?us-ascii?q?VSwn50dxrIx06vrpT4wJk2+C1Vv7cl9tVceaT8ZaUxC7JCXxo8NGVgzcvnrxSL?= =?us-ascii?q?awKT5nIaGjEflBZSDiDJ7R77RJ7ts23xse870jPMbp6+dqw9RTn3t/QjcxTvki?= =?us-ascii?q?pSbzM=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CkAQCtNgZYh7ggSbtcHhgNBQEXAQYBB?= =?us-ascii?q?oJ+AQEBAQGBHlKkOZQ4ggiGIgKCAjoSAQEBAQEBAQEBAQESAQEBCA0JCRkvgjI?= =?us-ascii?q?YghgBAQQnGQEBOA8LGC4gCwIBKRMIAQGIULUbhTABAQWIFyMGCYg6gliFE4UTm?= =?us-ascii?q?guDQIF4imZNiHASgQGFC4x7g34CJQdsBgiDD4F2WohWAQEB?= X-IPAS-Result: =?us-ascii?q?A0CkAQCtNgZYh7ggSbtcHhgNBQEXAQYBBoJ+AQEBAQGBHlK?= =?us-ascii?q?kOZQ4ggiGIgKCAjoSAQEBAQEBAQEBAQESAQEBCA0JCRkvgjIYghgBAQQnGQEBO?= =?us-ascii?q?A8LGC4gCwIBKRMIAQGIULUbhTABAQWIFyMGCYg6gliFE4UTmguDQIF4imZNiHA?= =?us-ascii?q?SgQGFC4x7g34CJQdsBgiDD4F2WohWAQEB?= X-IronPort-AV: E=Sophos;i="5.31,362,1473112800"; d="asc'?scan'208";a="197244019" Received: from mta112.f1.k8.com.br ([187.73.32.184]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Oct 2016 16:50:54 +0200 Received: from localhost (localhost [127.0.0.1]) by smtpz.f1.k8.com.br (Postfix) with ESMTP id C69DF80221 for ; Tue, 18 Oct 2016 14:50:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at k8.com.br Received: from smtpz.f1.k8.com.br ([127.0.0.1]) by localhost (mta112.f1.k8.com.br [127.0.0.1]) (amavisd-new, port 10024) with LMTP id RS7xEgmH-uLn for ; Tue, 18 Oct 2016 14:50:49 +0000 (UTC) Received: from [10.200.12.21] (unknown [201.76.188.234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtpz.f1.k8.com.br (Postfix) with ESMTPSA id 301BB801B1 for ; Tue, 18 Oct 2016 14:50:49 +0000 (UTC) X-DKIM: OpenDKIM Filter v2.6.8 smtpz.f1.k8.com.br 301BB801B1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digirati.com.br; s=default; t=1476802249; bh=TOfPfsHxK/d72ovglW0Ankdgna+6i5h1taI4FnEqBos=; h=Subject:To:References:From:Date:In-Reply-To; b=mXPRgJztD1V7Ht5bvQKbP+g1y2R2xF8DYw0DMy3ww6cTJDtWQ00FavJqbGpYgjvpr jyWcPf7+QfQF9WE1qg7WoszrOUA9nnuEwUuloLMxigS+YPnLUAkmr2DlKDqGWmexay xEUroY9yCxu3UJBeTE/k0Kc8k7KDqqzfafoVS9nA= To: caml-list@inria.fr References: <20161018142102.GA21704@frosties> From: Andre Nathan Message-ID: <0ee74760-8b24-66bd-2b5c-900df67e220a@digirati.com.br> Date: Tue, 18 Oct 2016 12:50:45 -0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20161018142102.GA21704@frosties> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="pDiA7PomcBrscBbUh62O2xLs4qPkWXxkR" Subject: Re: [Caml-list] Segfault with open GADTs This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --pDiA7PomcBrscBbUh62O2xLs4qPkWXxkR Content-Type: multipart/mixed; boundary="a9bNGMAJWAXVKAr2jKEgwkMReuLCTMpwH"; protected-headers="v1" From: Andre Nathan To: caml-list@inria.fr Message-ID: <0ee74760-8b24-66bd-2b5c-900df67e220a@digirati.com.br> Subject: Re: [Caml-list] Segfault with open GADTs References: <20161018142102.GA21704@frosties> In-Reply-To: <20161018142102.GA21704@frosties> --a9bNGMAJWAXVKAr2jKEgwkMReuLCTMpwH Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 10/18/2016 12:21 PM, Goswin von Brederlow wrote: > You can pass along the outermost to_string to all to_string > functions so they can restart from the outside when they recurse. Yep :) For the record, I got it working like this: In M0: let assert_false _ =3D assert false type f =3D { f : 'a. 'a t -> string } let rec to_string : type a b. ?f:f -> a t -> string =3D fun ?(f =3D { f =3D assert_false }) e -> match e with | I i -> "I:" ^ string_of_int i | S s -> "S:" ^ s | P (x, y) -> to_string ~f x ^ to_string ~f y | e -> f.f e In M1: let rec to_string' : type a. a t -> string =3D function | T t -> to_string ~f:{ f =3D to_string' } t | x -> to_string ~f:{ f =3D to_string' } x let to_string =3D to_string' Cheers, Andre --a9bNGMAJWAXVKAr2jKEgwkMReuLCTMpwH-- --pDiA7PomcBrscBbUh62O2xLs4qPkWXxkR Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJYBjbFAAoJED4JW1qwFY2cIe0IAJcH3Q+2QGGHXxknES8fTO2k 2g9zOEzFCR/tZyPSbEw2X3YcTAsystT6bYJFsw0ihqfr5W2Doki65EQ9u0N5l4bs 8oHgwvUuUaudBimaV5ImkBhxuAlq6p/yFDLIuhcGejUihvgAeh+WPAxnHKEnrUB1 QqjFjWXpQkAdACF+WGYWNvoh0nHBVjQNtfuNLHJX2uz2SehtyfG0WdhhwSvhS66w OpEaM+YL3piXTK89xAaTOE7Bg6eziDpI5JUVSW0skwY991gSCbFPgXXrIgyWH96K d7ZR241jwm05knaO6M92qOTIsdFoP4Mx/JC2QENp6b3JWJ8My74PQkJ6edRwGbM= =jqZ3 -----END PGP SIGNATURE----- --pDiA7PomcBrscBbUh62O2xLs4qPkWXxkR--