Ravi Mohan wrote:

Hi,
I've been working my way through CTM. One of my
friends and I were having a discussion about
programming languages and he was praising HAskell and
its "Monad io". I looked up haskell and monads in CTM and noticed that it isn't clear how *exactly* monads fit in. The part on haskell does not go into detail on monads and on page 332 there are few sentences
"The solution used in HAskell is more complicated: to
avoid explicit state and instead use a kind of
accumulator called a monad .. uses higher order progarmming to make state threading implicit.."

So does this mean monads are an alternate path to
explicit state representation in programming
languages? Where do monads fit into the series of
kernel langauges presented in CTM?


Any help  much
appeciated,
Regards,
Ravi

Dear Ravi,

You can use monads to represent state, but they don't give you
the full expressiveness of true state.  The discussion in section 4.8.2
(page 315) on modularity also holds for monadic representations
of state.  I also recommend that you read the discussion on "State
and modularity" on Lambda the Ultimate at:
 http://lambda-the-ultimate.org/classic/message9361.html

Monads can be added as a linguistic abstraction to the kernel
languages of CTM.  Usually monads are added to a lambda
calculus by defining a new function composition operation.
The new composition contains the accumulator of the monad.
The kernel languages of CTM do not define a lambda calculus,
but a process calculus.  I think that you can add a monad by
defining a new procedure application operation and a new
sequential composition operation, but I haven't actually done it
yet.  If you try it, please let me know how it turns out.

Peter



_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to