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
The Bridge Pattern in OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-03-28 (19:14)
From: blue storm <bluestorm.dylc@g...>
Subject: Re: [Caml-list] The Bridge Pattern in OCaml
> In Haskell, it would be very neat - define a Monad for composing the
> ASTs and then code just like you would any other Haskell program,
> you're just using a different Monad from normal.

>  In O'Caml, a lot less neat because the user providing the behaviour
> suddenly isn't really coding the algorithm in O'Caml, but creating a
> data-structure that represents the computation.

Could you elaborate a bit on this ?
It seems me that monads only provide (in this particular case) a
limited syntaxic sugar. Are they really an improvement ? If you've got
some example of monadic AST-building, i'd be interested.

Couldn't the pa_monad extension achieve the same job ? The more
general (and heavyweight) solution would be to build a full DSL using
camlp4, but i'm not sure of what you can win with a dedicated syntax.