caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Hezekiah M. Carty" <hcarty@atmos.umd.edu>
To: "Romain Bardou" <Romain.Bardou@lri.fr>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Attach an invariant to a type
Date: Thu, 31 Jan 2008 14:13:11 -0500	[thread overview]
Message-ID: <3a360f590801311113o4db1d660s206e7af4bcb3226@mail.gmail.com> (raw)
In-Reply-To: <47A20FC1.5040103@lri.fr>

On Jan 31, 2008 1:13 PM, Romain Bardou <Romain.Bardou@lri.fr> wrote:
> Wow, how could I forget about private types.
>
> However, you still need the of_int function.
>
> module Subindex: sig
>    type t = private int
>    val make: int -> t
> end = struct
>    type t = int
>    let make n =
>      assert (n >= 10 && x <= 100);
>      n
> end
>

This code does not work for me.  I get a "This fixed type is not an
object or variant" error on the "type t = private int" line.  From the
manual it looks like you would have to use something like this:

type t = private Index of int

to take advantage of private types.  Am I missing something?

Hez


  reply	other threads:[~2008-01-31 19:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-31 13:28 Dawid Toton
2008-01-31 13:50 ` [Caml-list] " Romain Bardou
2008-01-31 17:58   ` David Teller
2008-01-31 18:13     ` Romain Bardou
2008-01-31 19:13       ` Hezekiah M. Carty [this message]
2008-01-31 19:29         ` Stéphane Lescuyer
2008-01-31 19:51           ` Dawid Toton
2008-01-31 20:26             ` Edgar Friendly
2008-02-01 10:00               ` Keiko Nakata
2008-01-31 20:13           ` Romain Bardou
2008-02-10 18:00           ` Stéphane Glondu

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=3a360f590801311113o4db1d660s206e7af4bcb3226@mail.gmail.com \
    --to=hcarty@atmos.umd.edu \
    --cc=Romain.Bardou@lri.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).