From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 09856BBC1 for ; Fri, 28 Mar 2008 20:14:05 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhICAFfg7EdA6aq4c2dsb2JhbACRMwEMAwQFCRSUJYUw X-IronPort-AV: E=Sophos;i="4.25,572,1199660400"; d="scan'208";a="24316004" Received: from rn-out-0910.google.com ([64.233.170.184]) by mail4-smtp-sop.national.inria.fr with ESMTP; 28 Mar 2008 20:14:04 +0100 Received: by rn-out-0910.google.com with SMTP id s46so330788rnb.3 for ; Fri, 28 Mar 2008 12:14:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=ZoFl0p7FiRfuIpUokTaruNd8b4rD1Ey9HfMt1fykwPU=; b=GkvyFzgVEbPheD3pc4AUFpWGbcAv+pVXjVvGDxbkPtm6W21A9tbQBnZEihSqWzojcWhsUhfL0Bm8udLaJCFS5P4g2PQtdq/IVBn909K4FV9DU4xxddBVYj3BNNYYwQ4LeP/MscPNzo4POncjrwpqNdJyh7WGuE1j1o6NKMpIqm8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=XUNnStoRoHbzAtHUoiVroydKVdFs9etIs15n5c5olq2KhFPylbuiCDpWkU2/fc49uCVHSfZePAXzvAtRW65Q6xU1+rdcuXMD3AOHUsIy3XlT9jwgCOegpeKoTtUR/DLCsKuQLn8E8aoDfE0vJrJlDW6SBAORSmskQmOzWUClQ5k= Received: by 10.114.152.17 with SMTP id z17mr4410863wad.128.1206731642429; Fri, 28 Mar 2008 12:14:02 -0700 (PDT) Received: by 10.115.110.7 with HTTP; Fri, 28 Mar 2008 12:14:01 -0700 (PDT) Message-ID: <527cf6bc0803281214u632c74a6p554cd5914f6ce154@mail.gmail.com> Date: Fri, 28 Mar 2008 20:14:01 +0100 From: "blue storm" To: "David Thomas" Subject: Re: [Caml-list] The Bridge Pattern in OCaml Cc: "Raoul Duke" , caml-list@yquem.inria.fr In-Reply-To: <17503.82869.qm@web30502.mail.mud.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <91a2ba3e0803281123o68e86a1ej1d91f838c753232d@mail.gmail.com> <17503.82869.qm@web30502.mail.mud.yahoo.com> X-Spam: no; 0.00; ocaml:01 haskell:01 haskell:01 o'caml:01 o'caml:01 monads:01 monadic:01 camlp:01 syntax:01 storm:98 caml-list:01 computation:01 behaviour:01 algorithm:01 define:02 > 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.