caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Kakadu <kakadu.hafanana@gmail.com>
To: Caml List <caml-list@inria.fr>
Subject: [Caml-list] Implicit question about searching for implicit module definition in the functor argument.
Date: Wed, 3 Aug 2016 02:17:17 +0300	[thread overview]
Message-ID: <CAGmVoG04Zz3ne_HRREsXtmHvEm6Wz_sk7TdTg1++VituHw+-Zg@mail.gmail.com> (raw)

Hey, hackers.

I'm missing something obvious. Any fresh eyes around?

module type SHOW = sig
    type t
    val show : t -> string
end

let show {S : SHOW} x = S.show x;;

implicit module Show_int : (SHOW with type t = int) = struct
    type t = int
    let show = string_of_int
end

module type CORE = sig
  type 'a logic

  implicit module Show_logic(X: SHOW) : (SHOW with type t = X.t logic)
end

module Make(MK: CORE) = struct
  open MK
  open implicit MK (* doesn't help *)

  let foo (x: int logic) =
    let s = show x in (* Error: No instance found for implicit S. *)
    s
end


Kind regards,
Kakadu

             reply	other threads:[~2016-08-02 23:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-02 23:17 Kakadu [this message]
2016-08-03  5:18 ` Gawlitza, Thomas
2016-08-03 20:53   ` Kakadu

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=CAGmVoG04Zz3ne_HRREsXtmHvEm6Wz_sk7TdTg1++VituHw+-Zg@mail.gmail.com \
    --to=kakadu.hafanana@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).