In [1]:
module type Show = sig
    type t
    val show : t -> unit
end


Out[1]:
module type Show = sig type t val show : t -> unit end

In [2]:
let print (implicit S : Show) x = S.show x


Out[2]:
val print : (implicit S : Show) -> S.t -> unit = <fun>

In [3]:
implicit module Show_int = struct
    type t = int
    let show x = Printf.printf "Show_int: %i\n" x
end


Out[3]:
implicit module Show_int : sig type t = int val show : int -> unit end

In [4]:
implicit module Show_float_list = struct
    type t = float list
    let show x = 
        Printf.printf "Show_float: [ ";
        List.iter (fun f -> Printf.printf "%f " f) x;
        Printf.printf "]\n"
end


Out[4]:
implicit module Show_float_list :
  sig type t = float list val show : float list -> unit end

In [5]:
print 4


Show_int: 4
Out[5]:
- : unit = ()

In [6]:
print [1.;2.5;-3.4]


Show_float: [ 1.000000 2.500000 -3.400000 ]
Out[6]:
- : unit = ()