From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 5F0D87F1C3 for ; Sat, 24 Nov 2012 17:54:52 +0100 (CET) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of mmatalka@gmail.com) identity=pra; client-ip=209.85.217.182; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="mmatalka@gmail.com"; x-sender="mmatalka@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of mmatalka@gmail.com designates 209.85.217.182 as permitted sender) identity=mailfrom; client-ip=209.85.217.182; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="mmatalka@gmail.com"; x-sender="mmatalka@gmail.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@mail-lb0-f182.google.com) identity=helo; client-ip=209.85.217.182; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="mmatalka@gmail.com"; x-sender="postmaster@mail-lb0-f182.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ai0CANn6sFDRVdm2m2dsb2JhbABEgmyDPLoNCBYOAQEBAQEICRQUJ4IeAQEEASMEGQEbHQEDAQsGBQ4KAgIFIQICDwEEDQIRAQUBIhOHegEDCQYBC6Awi2RPgniEJAoZJw1ZiHUBBQyBFoosaYMugRMDiF6LToJxihiDMD+ELg X-IronPort-AV: E=Sophos;i="4.83,313,1352070000"; d="scan'208";a="163659825" Received: from mail-lb0-f182.google.com ([209.85.217.182]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 24 Nov 2012 17:54:51 +0100 Received: by mail-lb0-f182.google.com with SMTP id go10so9525562lbb.27 for ; Sat, 24 Nov 2012 08:54:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; bh=4obK0GeeI3hYrT8FZPNrJ1NcDHH4+5GuUDqq/Fd4PlM=; b=w+8ba83t7quJtY5mB5rIzFoox6adxraKkKbLvRjfEfQcelnnh8gPOrdApsnW0zaB/t +rZeDtyOly7ENP+Ipd7TmLSi+fdvvT8UVbQjKQRdtgT3MAVeIp9w315PSRf5xSshStpM tUyBzKwZV/VqncBKF4wNaxi1lNqbSgv1j9EIlxokHmSDxw/R2iPa5u5I+ZpcPSofQflW LQgtiIeX6by6WQOGyYDFTxcp6b2aSq7G4OawDPUjm8NjCbZCjMaR3g0aMrCf+Fdq4GLE 069BR/sHAOISq6byWlY7ZRntLkjd/oJUvuAMrSVGn7uBwk76UON7DfVyZY81k6zN7Qz/ 0Zng== Received: by 10.152.114.65 with SMTP id je1mr6452219lab.33.1353776090886; Sat, 24 Nov 2012 08:54:50 -0800 (PST) Received: from localhost ([2a01:7e00::f03c:91ff:fedf:4d21]) by mx.google.com with ESMTPS id u9sm481184lbf.5.2012.11.24.08.54.49 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 24 Nov 2012 08:54:50 -0800 (PST) From: Malcolm Matalka To: Chris Yocum Cc: =?utf-8?Q?Micha=C5=82?= Kurcewicz , caml-list@inria.fr References: <20121123114328.GD31371@gmail.com> <20121124163405.GA2158@gmail.com> Date: Sat, 24 Nov 2012 11:54:48 -0500 In-Reply-To: <20121124163405.GA2158@gmail.com> (Chris Yocum's message of "Sat, 24 Nov 2012 16:34:06 +0000") Message-ID: <87lidrym93.fsf@li195-236.members.linode.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] Monad Library? I haven't experienced a strong need for a state monad in Ocaml. I do tend to use Core's Option and Return (>>=3D) functions for sequencing code though. /M P.S. In general Ocamler's seem to prefer to write 'Store x' rather than 'Store(x)' Chris Yocum writes: > Thanks everyone, > > So basically from what I understand this is kind of like a StateMonad. > It seems to me that the state monad (hiding state in the type system) > would be a large boon. > > So, for instance, > > module type MONAD =3D > sig > type 'a t > val return : 'a -> 'a t > val bind : 'a t -> ('a -> 'b t) -> 'b t > end > > module StateMonad : MONAD =3D > struct > type 'a t =3D Store of 'a > let return x =3D Store(x) > let bind s f =3D > match s with > | Store(x) -> f x > let access =3D function Store(x) -> x > end > > This is a very, very basic implementation of a state monad? > > Thanks again. > > Chris > > On Fri, Nov 23, 2012 at 09:59:30PM +0100, Micha=C5=82 Kurcewicz wrote: >> If Core is too complex for you then you may take a look at spotlib - a >> small and elegant library written by Jun Furuse: >>=20 >> https://bitbucket.org/camlspotter/spotlib >>=20 >> I use it together with pa_monad_custom for all my monad needs. >>=20 >> Best, >>=20 >> --mk >>=20 >> On Fri, Nov 23, 2012 at 12:43 PM, Chris Yocum wrote: >> > Hi, >> > >> > 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 >> > 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? >> > >> > All the best, >> > Chris