caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Sébastien Hinderer" <Sebastien.Hinderer@inria.fr>
To: Gabriel Scherer <gabriel.scherer@gmail.com>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] Error: The type abbreviation t is cyclic while defining submodules
Date: Fri, 10 Jun 2016 22:18:40 +0200	[thread overview]
Message-ID: <20160610201840.GA2182@pl-59055.rocqadm.inria.fr> (raw)
In-Reply-To: <CAPFanBH3P8K9mghDE4=U6DDjobVbqNVLZYFqRUiR8+Jm1m4AZA@mail.gmail.com>

Gabriel Scherer (2016/06/10 16:05 -0400):
> P.S.: Note that "nonrec" is only in definitions (struct .. end) and
> signatures (sig .. end), not in equations such as "with type t = t"
> which are a different construct, interpreted recursively -- not the
> best choice for consistency, but well.

So to make an equality between two types public one has to first
introduce a signature, right?

Now the code looks like this:

type t = float * float

let compare = Pervasives.compare

(* Other functions on points *)

module OrderedPoints : Set.OrderedType with type t = t = struct
  type nonrec t = t
  let compare = compare
end

module PointSet (* : Set.S with type t = t *) = Set.Make(OrderedPoints)

Note the commented bit in the last line, when it is uncommented it does
indeed not work.

Thanks,

Sébastien.

  parent reply	other threads:[~2016-06-10 20:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-10 20:00 Sébastien Hinderer
2016-06-10 20:03 ` Gabriel Scherer
2016-06-10 20:05   ` Gabriel Scherer
2016-06-10 20:17     ` Gabriel Scherer
2016-06-10 20:18     ` Sébastien Hinderer [this message]
2016-06-10 20:23       ` Gabriel Scherer
2016-06-10 20:29         ` Sébastien Hinderer
2016-06-10 20:10   ` Sébastien Hinderer

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=20160610201840.GA2182@pl-59055.rocqadm.inria.fr \
    --to=sebastien.hinderer@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=gabriel.scherer@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;
as well as URLs for NNTP newsgroup(s).