Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Chris Tilt <cet@webcriteria.com>
To: OCAML <caml-list@inria.fr>
Subject: parameterized signatures
Date: Wed, 22 Dec 1999 11:32:25 -0800	[thread overview]
Message-ID: <38612749.528896CB@webcriteria.com> (raw)

Bonjour. S'il vous plaît pardon le manque de Français aujourd'hui.
Merci.

I have read (although poorly understood) the recent postings regarding
the need for parameterized signatures, which I think would help. Please
let me ask the question a different way.

Is there a way to refer to the type of a functor defined by a .mli file
in another .mli file? I am attempting to build a parameterized type and
they build a sub-type which will provide a specific implementation of
that signature. My problem is in expressing the interface of the second
type to use the constructed type from the first file.

Since some people have asked for a generalized graph module, and I also
have the need, I am trying to package one. Here is a snipet to help
explain my question. The issue is in the very last line.

Sorry for the long post and example. BTW, this code is being used in
production of a real product! Thank you all for your support of a great
programming language!

Merci, Chris

---- pgraph.mli ----
(* supply the core graph functionality *)
module type ParameterizedGraphType =
  sig
    type t
    type edge
    type vertex
    val compare: t -> t -> int
  end

module type S =
  sig
    type vid
    type pEdge
    type vertex = Vertex of vid * pVertex
    type edge = Edge of vid * vid * pEdge
    type t
    type graph = t
    ... some functions ...
  end

module Make : functor (Param: ParameterizedGraphType) ->
  (S with type vid = Param.t
     and type pVertex = Param.vertex
     and type pEdge = Param.edge)

---- pgraph.ml -----
implements pgraph.mli in the usual way

---- wgraph.ml -----
(* use the ParameterizedGraphType module (Pgraph) to build a custom
   graph which has Html.window values as vertex attributes. This is
   used by the old-generation profiler product *)
module type WindowGraphType =
  sig
    type t = string
    type vertex = Html.window
    type edge = float * float
    val compare: string -> string -> int
  end

=====> the problem area. How do I express the type of this module?
module type Wgraph = Pgraph.S ???




             reply	other threads:[~1999-12-22 22:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-22 19:32 Chris Tilt [this message]
1999-12-23 10:44 ` Markus Mottl

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=38612749.528896CB@webcriteria.com \
    --to=cet@webcriteria.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