caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: bobzhang <bobzhang1988@gmail.com>
To: Wojciech Meyer <wojciech.meyer@googlemail.com>
Cc: Francois Berenger <berenger@riken.jp>, caml-list@inria.fr
Subject: [Caml-list] Re: How to add a hook to Stream.junk?
Date: Tue, 20 Nov 2012 22:39:51 -0500	[thread overview]
Message-ID: <50AC4D07.2090504@gmail.com> (raw)
In-Reply-To: <wfvccztyqn.fsf@gmail.com>

On 11/20/12 10:34 PM, Wojciech Meyer wrote:
> Francois Berenger <berenger@riken.jp> writes:
>
>> Why the need for module type of and all?
>>
>> Why not simply:
>>
>> module MyStream = struct
>>    include Stream
>>    let junk =
>>      failwith "put your code here"
>> end;;
>
> Yes you could also do through a functor application.
>
> module MyStream(H : sig val junk_hook : unit -> unit end) =
> struct
>    include Stream
>    let junk stream =
>       H.junk_hook ();
>       junk stream
> end
neither works.
functor approach, as I pointed out, stream specialized on char.
overshadowing junk does not work
   a. it's not late binding, existing definitions will not be shadowed
   b. type does not check...
>
>
> --
> Wojciech Meyer
> http://danmey.org
>


  reply	other threads:[~2012-11-21  3:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-21  1:07 [Caml-list] " bob zhang
2012-11-21  1:35 ` Wojciech Meyer
2012-11-21  2:58   ` [Caml-list] " bobzhang
2012-11-21  3:37     ` Wojciech Meyer
2012-11-21  3:05   ` [Caml-list] " Francois Berenger
2012-11-21  3:34     ` Wojciech Meyer
2012-11-21  3:39       ` bobzhang [this message]
2012-11-21  3:45         ` [Caml-list] " Wojciech Meyer

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=50AC4D07.2090504@gmail.com \
    --to=bobzhang1988@gmail.com \
    --cc=berenger@riken.jp \
    --cc=caml-list@inria.fr \
    --cc=wojciech.meyer@googlemail.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).