caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Ivan <ivg@ieee.org>
To: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: [Caml-list] coping with circular dependencies
Date: Mon, 23 Jul 2012 11:30:14 +0400	[thread overview]
Message-ID: <2300481343028614@web14f.yandex.ru> (raw)

In a simplified form I've the following setup:

module a defines a type with some functions:

(* file a.mli *)
  type t
  ...
  val of_string: string -> t

module b is a parser, defining function parse, that can produce values of types A.t from, for example, strings:

(* file b.mli *)
  type t = A.t
  ...
  val parse_a : string -> t
  
When I try to compile this simple example, compiler refuses to accept it, reasoning that :

Error: The implementation a.ml does not match the interface a.cmi:
       Values do not match:
         val of_string : string -> B.t
       is not included in
         val of_string : string -> t


Are there're any solutions,  satisfying the following constraints:
1) I want A.t to be an abstract type.
2) IRL a.mli and b.mli are rather large files (b is produces from mll and mly files)




                 reply	other threads:[~2012-07-23  7:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=2300481343028614@web14f.yandex.ru \
    --to=ivg@ieee.org \
    --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).