From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA03837; Mon, 19 Nov 2001 13:56:46 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA04213 for ; Mon, 19 Nov 2001 13:56:45 +0100 (MET) Received: from mail.cs.uu.nl (sunset.cs.uu.nl [131.211.80.32]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id fAJCui117914; Mon, 19 Nov 2001 13:56:45 +0100 (MET) Received: from silvester.cs.uu.nl (silvester.cs.uu.nl [131.211.80.119]) by mail.cs.uu.nl (Postfix) with SMTP id 61AC84557; Mon, 19 Nov 2001 13:56:44 +0100 (MET) Received: by silvester.cs.uu.nl (sSMTP sendmail emulation); Mon, 19 Nov 2001 13:56:44 +0100 Date: Mon, 19 Nov 2001 13:56:43 +0100 From: Frank Atanassow To: Francois Pottier Cc: caml-list@inria.fr Subject: Re: [Caml-list] Re: variance, subtyping and monads... oh, my! Message-ID: <20011119135643.A13024@cs.uu.nl> References: <002001c17035$c722aa80$3363e195@pazo> <20011119091119.A29570@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20011119091119.A29570@pauillac.inria.fr>; from francois.pottier@inria.fr on Mon, Nov 19, 2001 at 09:11:19AM +0100 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Francois Pottier wrote (on 19-11-01 09:11 +0100): > Isn't that a bit harsh? Monads offer abstraction with respect to the way > certain side effects are performed. Because of ocaml's natural support for > many side effects (references, exceptions, I/O, ...), monads are seldom > needed in ocaml. What may make monads less useful in Ocaml than in Haskell is not the native support for side effects but rather the call-by-value evaluation. This is illustrated by the fact that all the Haskell implementations which support the IO monad also have native side effects, because that is the most efficient way to implement references. (An alternative is to thread the state through the computation explicitly, and do functional updates.) Another way to say this is that Ocaml already supports a monad, namely the one for CBV computations. It throws everything ("references, exceptions, I/O, ..") into this one monad, much like Haskell98 throws everything into the IO monad. Where Haskell has an advantage is that you can write new monads, and combine them at will. "Monad transformers and Modular Interpreters" [1] is a good example of the power this gives you. Personally, I think Ocaml programs could benefit from being written in a monadic style; I know I've been bitten by side effects on more than one occasion. But I'm not sure if Ocaml's type system is up to the task, and I'm also concerned that it won't optimize away all the consequent CPS-style code the way GHC does. [1] Sheng Liang, Paul Hudak, and Mark P. Jones. Monad Transformers and Modular Interpreters. In Conference Record of POPL'95: 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, San Francisco, CA, January 1995. (http://www.cse.ogi.edu/~mpj/pubs/modinterp.html) -- Frank Atanassow, Information & Computing Sciences, Utrecht University Padualaan 14, PO Box 80.089, 3508 TB Utrecht, Netherlands Tel +31 (030) 253-3261 Fax +31 (030) 251-379 ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr