From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=AWL,SPF_FAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 0C44ABC6B for ; Fri, 29 Jun 2007 08:25:37 +0200 (CEST) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by concorde.inria.fr (8.13.6/8.13.6) with SMTP id l5T6Pahn013343 for ; Fri, 29 Jun 2007 08:25:36 +0200 Received: (qmail invoked by alias); 29 Jun 2007 06:25:35 -0000 Received: from dialin-145-254-247-203.pools.arcor-ip.net (EHLO dialin-145-254-247-203.pools.arcor-ip.net) [145.254.247.203] by mail.gmx.net (mp021) with SMTP; 29 Jun 2007 08:25:35 +0200 X-Authenticated: #11134691 X-Provags-ID: V01U2FsdGVkX1+AquQnijKAalQco+9tCzkVRFM5gtIZ77fkEZItRN wsBTVAdGehlhZ8 Received: from dirk by feanor.private-host.de with local (masqmail 0.2.20) id 1I49is-0Wp-00 for ; Fri, 29 Jun 2007 08:12:50 +0200 Date: Fri, 29 Jun 2007 08:12:49 +0200 To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] The Implicit Accumulator: a design pattern using optional arguments Message-ID: <20070629061249.GA1998@feanor> References: <200706271314.35134.jon@ffconsultancy.com> <85519A86-E765-4C3A-B292-2F9B150913AC@lrde.epita.fr> <46839DD8.7040200@functionality.de> <200706281544.36719.jon@ffconsultancy.com> <4683DBCD.9020509@functionality.de> <20070628172029.GA6796@feanor> <46843252.60608@functionality.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <46843252.60608@functionality.de> User-Agent: Mutt/1.5.6+20040523i From: Dirk Thierbach X-Y-GMX-Trusted: 0 X-Miltered: at concorde with ID 4684A5E0.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; stack:01 hmmm:01 deallocation:01 stack:01 wrote:01 wrote:01 caml-list:01 functions:01 argument:02 implicit:03 pattern:04 problem:05 accumulator:05 typesetting:05 variation:06 Thomas Fischbacher wrote: > Dirk Thierbach wrote: >>>> Pass the stack as an argument to those functions that need it. >> So could one "hide the plumbing" in a monad? > Hmmm. In principle, yes. I think that should be possible here. > (Done this for a related problem where contextual typesetting > information is passed around.) And I think it has the additional advantage that deallocation is safe, because the typesystem guarantees that no reference to the stack(s) can escape the monad. It's more or less just a variation of the state monad. - Dirk