caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Philippe Veber <philippe.veber@gmail.com>
To: Jeremy Yallop <yallop@gmail.com>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] Parameterizing a function with a thread monad
Date: Wed, 24 Oct 2012 12:30:37 +0200	[thread overview]
Message-ID: <CAOOOohS8OAh-kf4yBgWrGG4kfVDdRAMC6BBhD=VN+A3LfODPPQ@mail.gmail.com> (raw)
In-Reply-To: <CAAxsn=G6NNZ9gH4e1bY0PqGkT_adi5D-B2gshD40nV4T4uvhRw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1012 bytes --]

2012/10/23 Jeremy Yallop <yallop@gmail.com>

> On 22 October 2012 23:09, Philippe Veber <philippe.veber@gmail.com> wrote:
> > A couple of libraries, like pgocaml for instance, define a functor over a
> > (monadic) thread implementation, like in the following:
> >
> > module type Thread = sig
> >   type 'a t
> >   val return : 'a -> 'a t
> >   val bind : 'a t -> ('a -> 'b t) -> 'b t
> > end
> >
> > module F(T : Thread) : sig
> >   val v : string -> string T.t
> > end
> >
> > Is it possible to define F as a function (ie at the value level)?
>
> Yes!  Matías Giovannini has a blog post showing how to do just that:
>
> http://alaska-kamtchatka.blogspot.co.uk/2011/09/higher-order-fun.html
>

Thanks a lot Jeremy, this is indeed exactly what I was looking for! I
suppose this (clever) representation has a cost at run-time. Maybe it'd be
worth to investigate it, as a typical monadic computation will use a lot of
bind/return operations. I'll try to have a look at it. Thanks again!

[-- Attachment #2: Type: text/html, Size: 1598 bytes --]

      parent reply	other threads:[~2012-10-24 10:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-22 22:09 Philippe Veber
2012-10-22 23:52 ` Jeremy Yallop
2012-10-23  7:56   ` Gabriel Scherer
2012-10-24 10:45     ` Philippe Veber
2012-10-24 10:30   ` Philippe Veber [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOOOohS8OAh-kf4yBgWrGG4kfVDdRAMC6BBhD=VN+A3LfODPPQ@mail.gmail.com' \
    --to=philippe.veber@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=yallop@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).