Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: jean.balthazar.fr@gmail.com
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Interpretation of an error message "type ('a, 'b) t should be ('a, 'c) t" in a signature?
Date: Tue, 21 Apr 2009 11:45:18 +0900 (JST)	[thread overview]
Message-ID: <20090421.114518.212473943.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <d83f21e60904201345o21881293l7d4f80373a6b6cb4@mail.gmail.com>

This is exactly the same problem as your previous post.
You are trying to define a non-regular type.
I.e., if you expand the definition of job, you get:

  type ('a,'b) batch = private
    < build : < create_batch : 'c.('a -> 'c) -> ('a,'c) batch; .. > ->
              ('a priority * 'a) list ->
              < create_batch : 'c.('b -> 'c) -> ('b,'c) batch; .. > ;
    .. >
(not a correct definition because job itself is a private row type,
 but this is just to show explicitly the occurences of batch)

All occurences of batch inside its own definition should have the same
parameters ('a,'b), but here both have different parameters.
I admit that the error message is a bit confusing because all
parameters are variables, and their names are not preserved by the
type-checker. If the name were preserved, this would be
       type ('a, 'c) batch should be ('a, 'b)

Jacques Garrigue

From: Jean Balthazar <jean.balthazar.fr@gmail.com>
> I try to define the signature of three interdependant classes that should
> then be derived and completed for various implementation. The code below
> causes the strange error messsage:
> 
>          File "tmp.ml", line 4, characters 7-92:
>          In the definition of job, type ('a, 'b) batch should be ('a, 'c)
> batch
> 
> Can you explain what is wrong with this signature?
> I was unable to find an answer to a similar problem in the archives.
> 
> Thank you very much.
> Jean
> 
> ----------------------------------------------------------------------------
> 
> module type JOB =
> sig
> 
>   type ('a, 'b) batch =  private < build : 'a job -> ('a priority * 'a) list
> -> 'b job; .. >
>   and 'b priority = private < next : 'b priority;  ..  >
>   and 'a job =  private < create_batch : 'c.('a -> 'c) -> ('a, 'c) batch;
> ..  >
> 
> end


      reply	other threads:[~2009-04-21  2:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-20 20:45 Jean Balthazar
2009-04-21  2:45 ` Jacques Garrigue [this message]

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=20090421.114518.212473943.garrigue@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=jean.balthazar.fr@gmail.com \
    /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