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.)

y