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 3CB6CBC37 for ; Tue, 9 Feb 2010 04:59:18 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AncBAI9scEtKfVI2mWdsb2JhbACbBzwBAQEBAQgLCgcTq3sKgUCFE4hxAQEDBYRPBIsu X-IronPort-AV: E=Sophos;i="4.49,434,1262559600"; d="scan'208";a="52073285" Received: from mail-ww0-f54.google.com ([74.125.82.54]) by mail1-smtp-roc.national.inria.fr with ESMTP; 09 Feb 2010 04:59:17 +0100 Received: by wwj40 with SMTP id 40so1848657wwj.27 for ; Mon, 08 Feb 2010 19:59:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:reply-to:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=l+sAMisyrokpfabL0wNOifR29u3v/eJm6MHLd7GoeTc=; b=GinTyzdaNlifenAK54LhyEQD1X6Fv9CaqNmWHi3tst2/Q3+oVmC/u7ClznZuuO7oE/ 2oqHvHhld4PMFygCmK/ACIW8IRMgUhx0Wk4kPhHlLZu08qcl4X5vUrh3g9rX3BxW+GiG eJv6OzZmVTfJFg6WQeAq4Z5eBfrrmnQ4GkPx4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; b=ipqCy31QNb4iAhiDhySNGOt5MOZAHPmMp2swF7e4Qs8uT8jeHyGv3bxGBrhBUuaLat GFN1qFVAIrHHkKQh3iQKslY91WctBgiJjiK3Nrp5LtYFNg30eNp+tHGj/7C2qty5uoIa Le66D3q8ZypSUfdycmkzkKjCq3p2pjelRKk7Q= MIME-Version: 1.0 Received: by 10.216.90.18 with SMTP id d18mr1784275wef.225.1265687957605; Mon, 08 Feb 2010 19:59:17 -0800 (PST) Reply-To: yminsky@gmail.com In-Reply-To: <14cf844b1002081907y2900c313q97ae0cb6f4c92394@mail.gmail.com> References: <14cf844b1002081907y2900c313q97ae0cb6f4c92394@mail.gmail.com> Date: Mon, 8 Feb 2010 22:59:17 -0500 Message-ID: <891bd3391002081959i4f9b70d4re1914ad7e439b5e3@mail.gmail.com> Subject: Re: [Caml-list] Preventing values from escaping a context From: Yaron Minsky To: Rich Neswold Cc: Inria Ocaml Mailing List Content-Type: multipart/alternative; boundary=0016e6d7790c1c0d4c047f22f16a X-Spam: no; 0.00; yaron:01 minsky:01 yminsky:01 ocaml:01 monads:01 ocaml:01 monads:01 haskell:01 haskell:01 idiom:01 idiom:01 wrote:01 wrote:01 caml-list:01 idiomatic:02 --0016e6d7790c1c0d4c047f22f16a Content-Type: text/plain; charset=ISO-8859-1 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.) y --0016e6d7790c1c0d4c047f22f16a Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Mon, Feb 8, 2010 at 10:07 PM, Rich Neswold <rich.neswold@gmail.com> wr= ote:
(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.=A0 You won't fin= d them in the standard library because the standard library is very conserv= ative.=A0 But you will find them in Jane Street's Core library, and we = use them reasonably often.=A0 I think there's no reason to avoid monads= in OCaml (although obviously there's not much to be gained by using th= em for vanilla effects, as is done in Haskell.)

y
--0016e6d7790c1c0d4c047f22f16a--