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=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 55AC0BBAF for ; Fri, 25 Jul 2008 17:46:28 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAGOSiUjVujhf/2dsb2JhbACwHQ X-IronPort-AV: E=Sophos;i="4.31,253,1215381600"; d="scan'208";a="13453300" Received: from witko.kerneis.info ([213.186.56.95]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 25 Jul 2008 17:46:28 +0200 Received: from [2001:660:3301:8061:216:41ff:fe10:7097] (helo=tatanka.kerneis.info) by witko.kerneis.info with esmtpsa (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1KMPUx-00073f-EO; Fri, 25 Jul 2008 17:46:27 +0200 Received: from gabriel by tatanka.kerneis.info with local (Exim 4.69) (envelope-from ) id 1KMPUc-00023B-U0; Fri, 25 Jul 2008 17:46:06 +0200 Date: Fri, 25 Jul 2008 17:46:06 +0200 From: Gabriel Kerneis To: Dawid Toton Cc: caml-list Subject: Re: [Caml-list] 'Nondeterministic' evaluation wrt exceptions Message-ID: <20080725154606.GC4803@kerneis.info> Mail-Followup-To: Dawid Toton , caml-list References: <4889F16B.3020903@uj.edu.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4889F16B.3020903@uj.edu.pl> User-Agent: Mutt/1.5.18 (2008-05-17) X-SA-Exim-Connect-IP: 2001:660:3301:8061:216:41ff:fe10:7097 X-SA-Exim-Mail-From: gabriel@kerneis.info X-SA-Exim-Scanned: No (on witko.kerneis.info); SAEximRunCond expanded to false X-Spam: no; 0.00; 0100,:01 syntax:01 monads:01 threads:01 wrote:01 exception:01 pps:01 caml-list:01 exceptions:01 jussieu:01 seems:03 solved:04 blocking:04 guess:04 fri:05 On Fri, Jul 25, 2008 at 04:29:47PM +0100, Dawid Toton wrote: > I have no idea what code the syntax extension should produce. My first > guess is to wrap everything in > type 'a wrapped = Exception | Value 'a > and make all aplications evaluated. But this seems to be a big headache. > Maybe this is well-known, already solved problem? Any ideas? The wrapping you describe looks a lot like a monad, and your problem definitely looks like having many (cooperative) threads, some of them needing to be detached (because they are blocking). You could have a look at http://ocsigen.org/lwt and adapt it to suit your needs. Pay attention in particular to the detach() function. Please, note I might be seeing monads and continuation-passing style everywhere, since this is my current research topic. Regards, -- Gabriel Kerneis