From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 5618781799 for ; Mon, 29 Jul 2013 14:40:18 +0200 (CEST) X-IronPort-AV: E=Sophos;i="4.89,769,1367964000"; d="scan'208";a="27791590" Received: from estephe.inria.fr (HELO [128.93.11.95]) ([128.93.11.95]) by mail2-relais-roc.national.inria.fr with ESMTP; 29 Jul 2013 14:40:17 +0200 Message-ID: <51F662B2.7070102@inria.fr> Date: Mon, 29 Jul 2013 14:40:18 +0200 From: Xavier Leroy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: Michael CC: caml-list@inria.fr References: In-Reply-To: X-Enigmail-Version: undefined Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] Writing Awk in OCaml On 2013-07-28 10:43, Michael wrote: > With the above signature, we can write (1) > > bind u f1: row -> state -> stat > bind (bind v f1) f2 : row -> state -> stat > > But it would be quite nice to be able to write the following expressions so > that they are defined and correctly type (2): > > bind u f1 : row -> state -> state > bind v f1 f2 : row -> state -> state > > Is there any way to rewrite things so that the cumbersome (1) can be replaced > by the slick (2) ? Just use a left-associative infix symbol for "bind", it will be real slick: let (++) = bind v ++ f1 ++ f2 (* i.e. bind (bind v f1) f2 *) Hope this helps, - Xavier Leroy