From: William Smith <bills@emu-bark.com>
To: Caml-list <caml-list@inria.fr>
Subject: [Caml-list] Declaring a parameterized type in a .mli
Date: Sun, 07 Apr 2013 23:17:53 -0400 [thread overview]
Message-ID: <516236E1.7090102@emu-bark.com> (raw)
Hi
I'm trying to create a generic ID module so that it is easy to make
multiple distinct ID classes. I want to be able to create sets and
maps of them so I've made my signature compatible with Set.Make but I'm
not making it that far yet. I want to have one class of IDs for NFA
states and another for DFA states etc. and I want to reuse the code when
I find I need other ID classes.
Here's what I've got in my .mli:
module IDRoot :
sig
end
module GenericID ( Root : sig end ) :
sig
type t
val compare : t -> t -> int
val to_string : t -> string
val cons : unit -> t
end
module Id = GenericID( IDRoot )
I get a syntax error even though I think I am following the reference
books online. The error is on the equal sign of the last line:
File "broken.mli", line 13, characters 10-11:
Error: Syntax error
(For each class of IDs I will declare another IDRoot but with a
different name.) Is there a better way? This one seems really simple
if I could correct the syntax error.
Thanks for any help you can offer.
Bill Smith
next reply other threads:[~2013-04-08 3:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-08 3:17 William Smith [this message]
2013-04-08 3:57 ` Ivan Gotovchits
2013-04-08 4:05 ` Markus Mottl
2013-04-08 4:09 ` Ivan Gotovchits
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=516236E1.7090102@emu-bark.com \
--to=bills@emu-bark.com \
--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