caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Implicit question about searching for implicit module definition in the functor argument.
@ 2016-08-02 23:17 Kakadu
  2016-08-03  5:18 ` Gawlitza, Thomas
  0 siblings, 1 reply; 3+ messages in thread
From: Kakadu @ 2016-08-02 23:17 UTC (permalink / raw)
  To: Caml List

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-03 20:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-02 23:17 [Caml-list] Implicit question about searching for implicit module definition in the functor argument Kakadu
2016-08-03  5:18 ` Gawlitza, Thomas
2016-08-03 20:53   ` Kakadu

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).