Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module type SHOW =
- sig
- type t
- val show : t -> string
- end
- let print (implicit Show : SHOW) x = Show.show x
- implicit module ShowInt = struct type t = int let show = string_of_int end
- implicit module ShowFloat = struct type t = float let show = string_of_float end
- implicit functor ShowPair (Show1 : SHOW) (Show2 : SHOW) =
- struct
- type t = Show1.t * Show2.t
- let show (x, y) = "(" ^ Show1.show x ^ ", " ^ Show2.show y ^ ")"
- end
- let rec grow1 : (implicit Show : SHOW) -> Show.t -> 'a =
- fun (implicit Show : SHOW) x -> grow1 (x, x)
- (*
- Characters 494-538:
- fun (implicit Show : SHOW) x -> grow1 (x, x);;
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Error: This expression has type (implicit Show : SHOW) -> 'b -> 'a
- but an expression was expected of type
- (implicit Show : SHOW) -> Show.t -> 'a
- This instance of Show.t is ambiguous:
- it would escape the scope of its equation
- *)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement