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 C457A7EEBF for ; Sat, 25 Jul 2015 14:34:42 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of oleg@okmij.org) identity=pra; client-ip=66.39.3.114; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="oleg@okmij.org"; x-sender="oleg@okmij.org"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of oleg@okmij.org designates 66.39.3.114 as permitted sender) identity=mailfrom; client-ip=66.39.3.114; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="oleg@okmij.org"; x-sender="oleg@okmij.org"; 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@mail1.g3.pair.com) identity=helo; client-ip=66.39.3.114; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="oleg@okmij.org"; x-sender="postmaster@mail1.g3.pair.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DlAACPgbNVnHIDJ0Jcg2lpAb1vhXkCgUBMAQEBAQEBEgEBAQEBCAsJCSEuhCQBAQMBOj8FFiE0BXeICwgNz0MBAQgCAR+LToJsgVBLBxeDAYEUBY01hzSBP4M5h0cCggtuli2EMmCCTAEBAQ X-IPAS-Result: A0DlAACPgbNVnHIDJ0Jcg2lpAb1vhXkCgUBMAQEBAQEBEgEBAQEBCAsJCSEuhCQBAQMBOj8FFiE0BXeICwgNz0MBAQgCAR+LToJsgVBLBxeDAYEUBY01hzSBP4M5h0cCggtuli2EMmCCTAEBAQ X-IronPort-AV: E=Sophos;i="5.15,542,1432591200"; d="scan'208";a="171603713" Received: from mail1.g3.pair.com ([66.39.3.114]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 25 Jul 2015 14:34:41 +0200 Received: from Magus.sf-private (fortigate.sf.ecei.tohoku.ac.jp [130.34.188.206]) by mail1.g3.pair.com (Postfix) with ESMTPSA id C5F2B34A94; Sat, 25 Jul 2015 08:34:38 -0400 (EDT) Date: Sat, 25 Jul 2015 21:42:50 +0900 From: Oleg To: edwin+ml-ocaml@etorok.net Cc: caml-list@inria.fr Message-ID: <20150725124250.GA2259@Magus.sf-private> Mail-Followup-To: Oleg , edwin+ml-ocaml@etorok.net, caml-list@inria.fr MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55B2A69F.2060104@etorok.net> User-Agent: Mutt/1.5.22 (2013-10-16) Subject: Re: [Caml-list] Clever typing for client-server communication? > > Once you have these types you might write type-level functions to > > retrieve the components. Here's a function that retrieves the 'src' > > component: > > > > type 'a src = 's constraint 'a = < src: 's; .. > > This is very useful to know, thanks! > It'd be interesting to know how you come up with these solutions :) This is probably a folklore, but it was mentioned on this list more than a decade ago by Jacques Garrigue. We have used this trick extensively in http://okmij.org/ftp/meta-programming/HPC.html#GE-generation (see the description on p11 of the SCP-metamonads.pdf paper, and many applications starting from p21)