Browse thread
environment idiom
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2004-12-13 (00:49) |
From: | skaller <skaller@u...> |
Subject: | Re: [Caml-list] environment idiom |
On Mon, 2004-12-13 at 06:09, Michael Walter wrote: > On 12 Dec 2004 16:33:29 +1100, skaller <skaller@users.sourceforge.net> wrote: > > Yes, that indeed is my intention. Basically, any non-transparent > > non-function code can be made purely functional and transparent > > with a simple transformation, yet it doesn't by this transformation > > get any easier to reason about the code. > Well, actually monadic I/O makes is easier to reason about code than > languages which allow for non-transparent side effects in functions. I > think you were making a really good argument pro monads yourself -- in > your C interpreter monad you can easily see what's making use of the C > interpreter (any function "in"/lifted to the C interpreter monad), and > what's not. Same for I/O -- you can assume that only functions > "in"/lifted to the IO monad (simply said, every value of type IO a) > are able to do I/O. This clearly allows easier reasoning about code. This is a good point, and it seems to support my thesis. What you seem to be saying is that in mixed monadic/plain code, the abstraction boundary is plain, which helps reasoning. So the monadic model is good, because it plainly separates the 'purely functional' non-monadic code, from the monadic code, which admits two distinct views -- at the lower level it is pure, whilst the higher level interpretation might not be -- depending both on the monad being used, and also how it is used. Compare with Ocaml which does not localise non-transparent code (using references, Hashtbl, etc). -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net