Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] [Q]: Co(ntra)variance and subtyping?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Markus Mottl <markus@o...>
Subject: Re: [Caml-list] Re: variance, subtyping and monads... oh, my!
On Mon, 19 Nov 2001, james woodyatt wrote:
> On Monday, November 19, 2001, at 12:11 , Francois Pottier wrote:
> > Isn't that a bit harsh?
> Maybe.  I'm more of a developer than a researcher.  As with any 
> research, it's not useful to me until I know how and why to apply it.

Even in OCaml people sometimes decide to apply monads. Just take a look
at the FFTW-library, whose code generator is implemented in OCaml:

The simplification engine for DAGs used there represents rewrite rules
with monad operators. This way they "look" as if they were normal
tree-rewrite rules, whereas in fact the monad operators hide the whole
graph rewriting that happens "behind the scene". I could surely imagine
other, maybe even more efficient ways of doing it, but I fear it will be
difficult to find anything that is only closely as elegant (and easily

> If by using monads, on the other hand, I can do something easily that 
> would otherwise be very awkward, then I'm sold.  So far, I have only 
> found examples of how to do things I can already do better with the 
> imperative and object-oriented styles in OCaml.

Objects are useful abstractions for states, whereas monads are
abstractions of computations (i.e. state transformations, like e.g.
rewriting steps as above). These two things solve different problems so
it wouldn't make much sense saying that one is "better" than the other.

Markus Mottl

Markus Mottl                                   
Austrian Research Institute
for Artificial Intelligence        
Bug reports:  FAQ:
To unsubscribe, mail  Archives: