caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Function not polymorphic enough
@ 2014-12-19 13:30 Maxence Guesdon
  2014-12-19 15:33 ` Gabriel Scherer
  0 siblings, 1 reply; 3+ messages in thread
From: Maxence Guesdon @ 2014-12-19 13:30 UTC (permalink / raw)
  To: caml-list

Hello,

With the following code:

let (fn, extend) =
  let module M = struct
    type t = { mutable f : 'a. ('a -> unit) -> 'a list -> unit }
    let v = 
       { f = fun (type a) -> fun (poly_a : a -> unit) -> fun _ ->
         assert false 
       }
  end in
  let fn = fun f x -> M.v.M.f x in
  let extend g = M.v.M.f <- g M.v.M.f in
  (fn, extend)

I get the following message about " g M.v.M.f":
Error: This field value has type ('b -> unit) -> 'b list -> unit
       which is less general than 'a. ('a -> unit) -> 'a list -> unit

Does anyone know how to make "g M.v.M.f" general enough ?

Regards,

Maxence 

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

end of thread, other threads:[~2014-12-19 18:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-19 13:30 [Caml-list] Function not polymorphic enough Maxence Guesdon
2014-12-19 15:33 ` Gabriel Scherer
2014-12-19 18:58   ` Maxence Guesdon

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