caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Siraaj Khandkar <siraaj@khandkar.net>
To: Francois Berenger <berenger@riken.jp>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] adding a function to an already existing module
Date: Fri, 11 Jan 2013 00:14:11 -0500	[thread overview]
Message-ID: <FDECAF90-9129-44A5-9388-E4E4C53370BD@khandkar.net> (raw)
In-Reply-To: <50EF9E2B.1010100@riken.jp>

module MyList = struct
    include List

   let foo l = bar l
end


On Jan 11, 2013, at 0:07, Francois Berenger <berenger@riken.jp> wrote:

> Hello,
> 
> Let's say I want to add a function to the List module
> of the std lib.
> 
> I'd like to do this without having to change list.ml
> in the std lib.
> 
> And, my function need to have access to everything available
> in list.ml (constructors, type names, etc.).
> 
> Is this possible and how to do this?
> 
> For example, I want to create MyList, and this module
> is the exact List module plus some functions of my own.
> Then, some of my code would use MyList instead of List.
> 
> Thanks a lot,
> F.
> 
> PS: a full copy-paste of list.ml is considered cheating ;)
> 
> -- 
> 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

  reply	other threads:[~2013-01-11  5:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-11  5:07 Francois Berenger
2013-01-11  5:14 ` Siraaj Khandkar [this message]
2013-01-11  5:26   ` Francois Berenger
2013-01-11  5:47     ` Siraaj Khandkar

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=FDECAF90-9129-44A5-9388-E4E4C53370BD@khandkar.net \
    --to=siraaj@khandkar.net \
    --cc=berenger@riken.jp \
    --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).