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 266157F1C3 for ; Fri, 23 Nov 2012 13:10:04 +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: AlUBAEpmr1AmacjlmWdsb2JhbABEFq1fkjgeDgEBAQEBCAsLBxQngh4BAQMCQAEBLAsBDwsLDQ0hIQESAQUBChIGExKHaQMPAwEIoD2KdIQ3AQWFGQMKiU4Gi05pBYQ8klKBXYFVgRyKFoMwFimEEIFfJBo X-IronPort-AV: E=Sophos;i="4.83,307,1352070000"; d="scan'208";a="163559181" 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:59 +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 1Tbs51-0003Re-4y for caml-list@inria.fr; Fri, 23 Nov 2012 07:09:59 -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 1Tbs51-0008Mz-3s for caml-list@inria.fr; Fri, 23 Nov 2012 07:09:59 -0500 Received: from mail-ea0-f198.google.com ([209.85.215.198]) by mxgoog2.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1Tbs50-0004n5-W3 for caml-list@inria.fr; Fri, 23 Nov 2012 07:09:59 -0500 Received: by mail-ea0-f198.google.com with SMTP id c13so4246788eaa.9 for ; Fri, 23 Nov 2012 04:09:58 -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=kbcnqV3xqxG6S8+TfB7v06aEGm/4KSZahTCxZ2y1vQ4=; b=tgalWNe6+QEiez4kW+rupZXE2ZwQdxH/pHoGxA96d0fw1zLCNKVlV8hDD7z6xI/lG2 sNk6QmBx37U/gv+SsUCSzchOgLaVKc5QX7Q8H1z2+5ypTBDJGm1f/fd8fGM8EgSrO8WA 9584EuGdY+dtTVVEJ+Z7x9jFSFqx8nkM/atKc= 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=kbcnqV3xqxG6S8+TfB7v06aEGm/4KSZahTCxZ2y1vQ4=; b=Bw7rEcysLFyQMiEWqgBl4z/ZSKKoWojFzjQYN8Xg6UPX894ZguF6I5l8XS8LD9/qGz utUO+TlAq6LUkBHpvqkRgkhMiimCEvpvrUzNc8M1LAqY+J243sALbRgxDXyt2GPl9jxb DygUN9GfL8WJPp905zmKZDyxnJD689v50Yb4GoWbylw/ZUkswq7UjXSu7fNaRNyXgZTz QHwIOObpnUa6XgPor4lzvjUrkFVaUg85tENEVkcdCfsXsM94nXOMMRgYCzc7x/2lqWh5 w2HTxm3mXYgC5+XT++4KQG3XgVyJMvcD7YE/w6P0wkI64qC1U0maRJdVrGVyVEoova1m NNEQ== Received: by 10.204.147.25 with SMTP id j25mr1193860bkv.36.1353672598286; Fri, 23 Nov 2012 04:09:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.204.147.25 with SMTP id j25mr1193854bkv.36.1353672598125; Fri, 23 Nov 2012 04:09:58 -0800 (PST) Received: by 10.204.35.77 with HTTP; Fri, 23 Nov 2012 04:09:58 -0800 (PST) X-Originating-IP: [80.169.196.210] In-Reply-To: References: <20121123114328.GD31371@gmail.com> Date: Fri, 23 Nov 2012 12:09:58 +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: ALoCoQlnXZ35oK8fnpNTyZ6Re4axAZQsKUVE5g+nDGa4lULTzoLTyaSj9z7zDcbnml3Ofzy3wi+NJp6Gld+EuSXLa8ZPIaBkB1LGhj2sY7aKOU0wAIQR3B4hxIXyw27B+zGvAzAAHEsLiRweg60TbYrzmb9HPh8XrA== Subject: Re: [Caml-list] Monad Library? Of, and of course it features instances for Option.t, Result.t, Or_error.t, List.t and all the other standard types inside core! On Fri, Nov 23, 2012 at 12:09 PM, David House wrote: > 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