English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
environment idiom
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-12-12 (19:09)
From: Michael Walter <michael.walter@g...>
Subject: Re: [Caml-list] environment idiom
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.

- Michael