caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Maxence Guesdon <Maxence.Guesdon@inria.fr>
To: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: [Caml-list] Function not polymorphic enough
Date: Fri, 19 Dec 2014 14:30:39 +0100	[thread overview]
Message-ID: <20141219143039.425107b3@alcazar2> (raw)

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 

             reply	other threads:[~2014-12-19 13:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-19 13:30 Maxence Guesdon [this message]
2014-12-19 15:33 ` Gabriel Scherer
2014-12-19 18:58   ` Maxence Guesdon

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=20141219143039.425107b3@alcazar2 \
    --to=maxence.guesdon@inria.fr \
    --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).