From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id B6759BC37 for ; Tue, 9 Feb 2010 18:16:39 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApsBAOImcUvRVdK5kGdsb2JhbACDM413ghKHSjwBAQEBCQkMBxMDrkEugUqFKohxAQEDBYN0WwQ X-IronPort-AV: E=Sophos;i="4.49,437,1262559600"; d="scan'208";a="52197476" Received: from mail-yx0-f185.google.com ([209.85.210.185]) by mail1-smtp-roc.national.inria.fr with ESMTP; 09 Feb 2010 18:16:39 +0100 Received: by yxe15 with SMTP id 15so8708429yxe.9 for ; Tue, 09 Feb 2010 09:16:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=XRJ/Y3cCoH96qtV7JVwWZUQr1ycW/2IsyMmqeF9ESYk=; b=HeUryLAsMTVgxy/AxU6aa3F1nELTJiRBCzJDoM6T5AY2KFlRAKKf00QLt2uWluRzK8 b38s/oBaQbJhol7CkGAfl/3fem4/S7bKZmd+KK6TwjPrseFn3W6PamIhmsFzI8pNYfF5 v4eF3Qu+AIG714liVt9lQuqF/LV9tYh9KBOy8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=oU9IqAqUOFMHMMND+lrYGtVHN/xPPVDgsSaRYof/vL3bzAPwGttHIFhwQU7aCsBS09 m5VHuKmE1kuxeJ+dqsx6kdRII7Ff9Du2Ah6/PeNfDNMTGv3OZWbcRh2ibYihJC8L2IBS yyA5SzMu9vD1FTZfCUhkyPH3Fbfw1arnARNmE= MIME-Version: 1.0 Received: by 10.101.51.7 with SMTP id d7mr3515094ank.201.1265735798347; Tue, 09 Feb 2010 09:16:38 -0800 (PST) In-Reply-To: <891bd3391002081959i4f9b70d4re1914ad7e439b5e3@mail.gmail.com> References: <14cf844b1002081907y2900c313q97ae0cb6f4c92394@mail.gmail.com> <891bd3391002081959i4f9b70d4re1914ad7e439b5e3@mail.gmail.com> Date: Tue, 9 Feb 2010 11:16:38 -0600 Message-ID: <14cf844b1002090916m7cd2bc27pf189edbd7f7ddf51@mail.gmail.com> Subject: Re: [Caml-list] Preventing values from escaping a context From: Rich Neswold To: yminsky@gmail.com Cc: Inria Ocaml Mailing List Content-Type: multipart/alternative; boundary=001636eee264a3dace047f2e1474 X-Spam: no; 0.00; yaron:01 minsky:01 yminsky:01 ocaml:01 monads:01 ocaml:01 monads:01 haskell:01 haskell:01 monadic:01 yaron:01 minsky:01 yminsky:01 monadic:01 idiom:01 X-Attachments: cset="UTF-8" cset="UTF-8" --001636eee264a3dace047f2e1474 Content-Type: text/plain; charset=UTF-8 On Mon, Feb 8, 2010 at 9:59 PM, Yaron Minsky wrote: > On Mon, Feb 8, 2010 at 10:07 PM, Rich Neswold wrote: > >> (I realize that making this context a monad is a legitimate solution. >> However, until I see the Ocaml community including monads in the standard >> library, I think I'll stick with idiomatic Ocaml. I'd also like to solve >> this functionally, so I'm discounting the use of objects. Sorry for these >> constraints!) >> > > I don't know that monads solve your problem here, but monads are a > perfectly reasonable idiom in OCaml. You won't find them in the standard > library because the standard library is very conservative. But you will > find them in Jane Street's Core library, and we use them reasonably often. > I think there's no reason to avoid monads in OCaml (although obviously > there's not much to be gained by using them for vanilla effects, as is done > in Haskell.) > I've used monads in Haskell to "hide" a parameter, so I may be able to do the same for this case. Since I think I'm also going to use the Lwt library, which is monadic, I wouldn't be setting the precedent. Thanks, I'll also look into adding Jane Street's Core library to my installation. -- Rich Google Reader: https://www.google.com/reader/shared/rich.neswold Jabber ID: rich@neswold.homeunix.net --001636eee264a3dace047f2e1474 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, Feb 8, 2010 at 9:59 PM, Yaron Minsky <yminsky@gmail.com> wrote:
On Mon, Feb 8, 2010 at 10:07 PM, Rich Neswold <ri= ch.neswold@gmail.com> wrote:
(I realize that making this context a monad is a legitimate solution. = However, until I see the Ocaml community including monads in the standard l= ibrary, I think I'll stick with idiomatic Ocaml. I'd also like to s= olve this functionally, so I'm discounting the use of objects. Sorry fo= r these constraints!)

I don't know that monads solve your problem= here, but monads are a perfectly reasonable idiom in OCaml.=C2=A0 You won&= #39;t find them in the standard library because the standard library is ver= y conservative.=C2=A0 But you will find them in Jane Street's Core libr= ary, and we use them reasonably often.=C2=A0 I think there's no reason = to avoid monads in OCaml (although obviously there's not much to be gai= ned by using them for vanilla effects, as is done in Haskell.)

I've used monads in Ha= skell to "hide" a parameter, so I may be able to do the same for = this case. Since I think I'm also going to use the Lwt library, which i= s monadic, I wouldn't be setting the precedent.

Thanks, I'll also look into adding Jane Street'= s Core library to my installation.
--001636eee264a3dace047f2e1474--