caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Arnaud Spiwack <Arnaud.Spiwack@lix.polytechnique.fr>
To: bob zhang <bobzhang1988@gmail.com>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Sharing the code between Monad and MonadState?
Date: Mon, 25 Jun 2012 08:43:59 +0200	[thread overview]
Message-ID: <CAMoPVjeCbmUEWcHKfaceAgr7CgB-0qKNGRSO7+MosDfzZtVydA@mail.gmail.com> (raw)
In-Reply-To: <CANcqPu6cQ5pPRggafbyyNkYNNarBb14amdaS=kA=SV_naz+vgw@mail.gmail.com>

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

I fail to see why you would use first class modules for that. What you are
"really" trying to use are just functors. Granted the syntax for functors
is awful. But if you are not willing to bear with it, then you would expect
to have some boilerplate. That said, your types monad and monad_state are
the types of a particular monad and a particular state monad (which have
certain initiality property). There is no reason for them to be related,
which may also be the cause of code duplication.


Arnaud Spiwack


On 23 June 2012 16:32, bob zhang <bobzhang1988@gmail.com> wrote:

> Hi List,
>    Given the syntax of first class module is improved a lot. I try to
> encode Monad and MonadState,  http://ideone.com/HgG4M
> Unfortunately I found it's still impossible to share the code between
> differrent Monad Instances. Is it theoretically impossible or I missed
> something?
>    Many thanks
>
> --
> -- Bob
>

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

      reply	other threads:[~2012-06-25  6:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-23 14:32 bob zhang
2012-06-25  6:43 ` Arnaud Spiwack [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=CAMoPVjeCbmUEWcHKfaceAgr7CgB-0qKNGRSO7+MosDfzZtVydA@mail.gmail.com \
    --to=arnaud.spiwack@lix.polytechnique.fr \
    --cc=bobzhang1988@gmail.com \
    --cc=caml-list@inria.fr \
    /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).