I wrote:
>  My current understanding is along the lines Raul quoted: that is, a monad
>  is a way to package up "the state of the world" as an
>  input

Devon responded:
>  This seems no different than strict functional programming (dis-allowing
>  globals).

Not quite, though I agree the effects are the same (this is what Raul was 
getting at).  In strict functional programming you can
pass in, e.g., a filename.  The outputs of such a strict functional program can 
differ from invocation to invocation (as the
contents of the file change), even though the nominal input is unchanged:  this 
is anathema to strict functional programming.
Monads are a way to solve this problem (but knowing your pragmatic bent, I 
should probably have scare-quoted "solve" and "problem"
:).

The IO monad differs from the filename in that it represents 
the-file-at-that-time, so if you invoked it again after the file
changed, strictly speaking you've passed in a different input, so a different 
output is justifiable.  This is just making the
contents of the file, an implicit input,  explicit.  That said, it seems like 
monads, as a syntactic construct, would allow you to
make this explicit input implicit again (for convenience's sake). 

I think, anyway.

-Dan

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to