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 mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id A5DBB7F1C3 for ; Sat, 24 Nov 2012 18:04:45 +0100 (CET) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of cyocum@gmail.com) identity=pra; client-ip=74.125.82.52; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="cyocum@gmail.com"; x-sender="cyocum@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of cyocum@gmail.com designates 74.125.82.52 as permitted sender) identity=mailfrom; client-ip=74.125.82.52; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="cyocum@gmail.com"; x-sender="cyocum@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-wg0-f52.google.com) identity=helo; client-ip=74.125.82.52; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="cyocum@gmail.com"; x-sender="postmaster@mail-wg0-f52.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao0BAL79sFBKfVI0imdsb2JhbABEhii6DQgWDgEBAQoJDQcSBiOCHgEBBSMEGQEbHQEDDAYFCwMKKgICFA0CEQEFASITh3oBAw8ECKAwi2RPgniEIQoZJw1ZiHUBBQyLQmmDLjJhA5QsgVQBgRyKGIFSgV4/hBA X-IronPort-AV: E=Sophos;i="4.83,313,1352070000"; d="asc'?scan'208";a="182982834" Received: from mail-wg0-f52.google.com ([74.125.82.52]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 24 Nov 2012 18:04:45 +0100 Received: by mail-wg0-f52.google.com with SMTP id fg15so2172386wgb.9 for ; Sat, 24 Nov 2012 09:04:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=W30+pcuOZiJo7jQALCLQp2Xp+WDp6hwQvDD4j/z+P8E=; b=aysCLz7zLxDVugt5brwrigbfMvIbnyqVav+LkimO4dzbllwmVZXKBNgs2FKzhx/eL4 MqmhOiLoL9SJQ75rtKyMbwQlSnXTxkxyYBfNZd/j76I/PbQBT+7YvvOETcKKcZnieHiG Fv8Ab+h7yiehc0WOoAwFP7riKK3K366F6tj2diPRBAaWR8WLgMdUWzhPJSwsSEWv9jgE avYPjThS00bAEl4wvwN/VcYYgSHQJt9eYcdwUAzHrqGtHjqRdRgomUim1NjIJMx3eRNi n/DkY4NwhRb+GtafBXKqwEWabtddWT/yx1EgcO/2Lu7SeKeZg9BDJeOwDnI3vV6Hmg1N Yokw== Received: by 10.216.216.80 with SMTP id f58mr2652085wep.167.1353776684644; Sat, 24 Nov 2012 09:04:44 -0800 (PST) Received: from localhost (gilbertsed.plus.com. [81.174.226.62]) by mx.google.com with ESMTPS id gk9sm13464496wib.4.2012.11.24.09.04.43 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 24 Nov 2012 09:04:44 -0800 (PST) Date: Sat, 24 Nov 2012 17:04:43 +0000 From: Chris Yocum To: Malcolm Matalka Cc: =?utf-8?Q?Micha=C5=82?= Kurcewicz , caml-list@inria.fr Message-ID: <20121124170442.GC2158@gmail.com> References: <20121123114328.GD31371@gmail.com> <20121124163405.GA2158@gmail.com> <87lidrym93.fsf@li195-236.members.linode.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="adJ1OR3c6QgCpb/j" Content-Disposition: inline In-Reply-To: <87lidrym93.fsf@li195-236.members.linode.com> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [Caml-list] Monad Library? --adJ1OR3c6QgCpb/j Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Yeah, I was thinking again after sending it that this isn't really needed when you have functional updates and other ways of managing state. Chris On Sat, Nov 24, 2012 at 11:54:48AM -0500, Malcolm Matalka wrote: > 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. >=20 > /M >=20 > P.S. In general Ocamler's seem to prefer to write 'Store x' rather than > 'Store(x)' >=20 >=20 > Chris Yocum writes: >=20 > > 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 th= at > >> > 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 f= or > >> > Ocaml? > >> > > >> > All the best, > >> > Chris --adJ1OR3c6QgCpb/j Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iF4EAREIAAYFAlCw/ioACgkQDjE+CSbP7HrmBQEAp1pDDZNkMy6BppleCjCpM9gW SnbB7s76aCaH9HezcnAA/RleWlGNcJeHnoZAzGLE9JFGrsT0ybvHWwxsSpWIK0p7 =rY6C -----END PGP SIGNATURE----- --adJ1OR3c6QgCpb/j--