From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id 5839A7F1DA for ; Fri, 23 Nov 2012 13:10:01 +0100 (CET) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of dhouse@janestreet.com) identity=pra; client-ip=38.105.200.229; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="dhouse@janestreet.com"; x-sender="dhouse@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of dhouse@janestreet.com designates 38.105.200.229 as permitted sender) identity=mailfrom; client-ip=38.105.200.229; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="dhouse@janestreet.com"; x-sender="dhouse@janestreet.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@tot-dmz-mxout1.janestreet.com) identity=helo; client-ip=38.105.200.229; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="dhouse@janestreet.com"; x-sender="postmaster@tot-dmz-mxout1.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlUBAEpmr1AmacjlmWdsb2JhbABEFq1fkjgeDgEBAQEBCAsLBxQngh4BAQMCQAEBLAsBDwsLDQ0hIQESAQUBChIGEwgKh2kDDwMBCKA9inSENwEFhRkDColOBotOaQWEPJJSgV2BVYEcihaDMBYphBCBXyQa X-IronPort-AV: E=Sophos;i="4.83,307,1352070000"; d="scan'208";a="163559170" Received: from mx5.janestreet.com (HELO tot-dmz-mxout1.janestreet.com) ([38.105.200.229]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 23 Nov 2012 13:09:54 +0100 Received: from tot-smtp.delacy.com ([172.27.22.35] helo=tot-is-smtp) by tot-dmz-mxout1.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1Tbs4F-0003QO-0y for caml-list@inria.fr; Fri, 23 Nov 2012 07:09:11 -0500 Received: from tot-dmz-mxgoog1.delacy.com ([172.27.224.14] helo=mxgoog2.janestreet.com) by tot-is-smtp with esmtps (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1Tbs4E-0008Ig-Vm for caml-list@inria.fr; Fri, 23 Nov 2012 07:09:10 -0500 Received: from mail-la0-f70.google.com ([209.85.215.70]) by mxgoog2.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1Tbs4E-0004mX-Qf for caml-list@inria.fr; Fri, 23 Nov 2012 07:09:10 -0500 Received: by mail-la0-f70.google.com with SMTP id e12so6740371lag.9 for ; Fri, 23 Nov 2012 04:09:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=CFNHEBYePLfKSN73hUMHkjUhkTIESh5NsDcYji42eNg=; b=DBqbltSkLq+GC43ur2U5P+MXtRFe7O0lq4zp+Uq2vREnHGsSs+HNug+tZvVHLfl5Sk cTTX98pN9Jd3fPFyOzO20YDg0lEjEFW8i8bZllIkzxjvTegbKZ5/WwcdO9+jEmXnNgaI Karq1JnbnKOyZ9VDtXHMZ5bTyYMAQ2BWz9DIU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:cc:content-type:x-gm-message-state; bh=CFNHEBYePLfKSN73hUMHkjUhkTIESh5NsDcYji42eNg=; b=el3r6PHVbuj+4r8oY/IhacRCNaRRqq/zdUpp4YD9b8t9na5dATjU5r8I7UX5bwHgcU Jy2tMh1rFKJDwAXcr5eR0gISuR+AgOE+w6fA0fedRxn+wGjn+zcqq8QU6PzrrEqM0mf3 uxWb2KBgfJDJbAaidKwU2jsE3jYPMP8EJPzGQCMADm4kM0fcgiUgfJ2ciF2p/nD7VFHv l7Z+pdHj5GNy1/9y+RF7sdkrvKyQPL8HTKqcdBOg+ZupujzeFqZ0kLbqwjHVc5mD9vmO 9hyAebWqZoiq/Z3Sx8JcRTPlsnmixWcA9wncq1/tf+6yOxY13dg43tB0uAz8fmCzeAFB 0hOg== Received: by 10.204.150.218 with SMTP id z26mr1230559bkv.95.1353672549873; Fri, 23 Nov 2012 04:09:09 -0800 (PST) MIME-Version: 1.0 Received: by 10.204.150.218 with SMTP id z26mr1230557bkv.95.1353672549738; Fri, 23 Nov 2012 04:09:09 -0800 (PST) Received: by 10.204.35.77 with HTTP; Fri, 23 Nov 2012 04:09:09 -0800 (PST) X-Originating-IP: [80.169.196.210] In-Reply-To: References: <20121123114328.GD31371@gmail.com> Date: Fri, 23 Nov 2012 12:09:09 +0000 Message-ID: From: David House To: Wojciech Meyer Cc: Chris Yocum , Caml List Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQnebv2s39O5CmZhjQwTuvApelr036lVkPiwp36Z83dEWAD/UZ+BpT5JPt1wO45NP8AEP2TOYB75xzZMU6jjjiFUhIg9hoYCnK7kdEGwd4JrY3ElCURj35qD5ch1zoAZceyd98tsE6/dA9RTrP+Ssx1cAtM8WA== Subject: Re: [Caml-list] Monad Library? The Core library [1] has a good monad library that gets used in basically every single Jane Street program (and notably inside async). Among its features are: * Module types for monads with one or two type parameters * Functors to make modules satisfying those signatures given just bind + return * "Infix" submodules which one can locally open ("let open Option.Monad_infix in") in order to temporarily work inside another monad -- very useful. It notably does *not* feature a syntax extension to make monadic computations look pretty. You must write out the binds and returns yourself. To be honest, the reason for this is mostly history, but we actually have some anecdotal evidence now that writing in the explicit style makes things easier to understand for authors and readers of code. [1]: https://bitbucket.org/yminsky/ocaml-core/wiki/Home On Fri, Nov 23, 2012 at 11:54 AM, Wojciech Meyer wrote: > On Fri, Nov 23, 2012 at 11:43 AM, Chris Yocum wrote: >> I was looking into using Monads in my programs but I am slightly at a >> loss as to what library is in general use. There is pa_monad but that > > pa_monad is really useful and nice, I think the updated library is > available as pa_monad_custom OPAM package. > >> seems to be a ocamlp4 exention and not a library. There is >> http://lambda.jimpryor.net/monad_library/ but that doesn't seem to be >> in opam or in godi so I am unsure as to its status. >> >> Does anyone have any suggestion for a well supported monad library for >> Ocaml? > > First I would need to find an answer what do you mean by a monad library. > > Monads is a general abstraction with a very simple interface. so they > don't require library as such. > > However I agree it would be good to have some library that provides a > monadic interface to some common functionality found maybe in std > libraries, also some way of composing monads would be good having > monad transformers along. Batteries included offer monadic interface > to some common data types like list, bool, option. > > You could look at Xavier Leroy's lectures here [1] to see the > excellent examples of using monads in OCaml. > > For somewhat advanced type system trickery to use generic interface > for monads you can look at this excellent post [2]. > > -Wojciech > > [1] http://gallium.inria.fr/~xleroy/mpri/progfunc/monads.2up.pdf > [2] http://alaska-kamtchatka.blogspot.co.uk/2011/09/higher-order-fun.html > [3] http://batteries.forge.ocamlcore.org/ > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs