Version française
Home     About     Download     Resources     Contact us    
Browse thread
Preventing values from escaping a context
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Rich Neswold <rich.neswold@g...>
Subject: Re: [Caml-list] Preventing values from escaping a context
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 <rich.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
>> 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