caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Leo White <lpw25@cam.ac.uk>
To: SEROT Jocelyn <Jocelyn.SEROT@univ-bpclermont.fr>
Cc: OCaML Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Question on functors (again...)
Date: Tue, 21 Jan 2014 13:32:23 +0000	[thread overview]
Message-ID: <86lhy98nq0.fsf@cam.ac.uk> (raw)
In-Reply-To: <20140121120954.Horde.QQKslk0F5ldpqozcxKyq3g1@wmail.univ-bpclermont.fr> (SEROT Jocelyn's message of "Tue, 21 Jan 2014 12:09:54 +0100")

> Unfortunately, this is not possible since the ELT signature is  actually more complex than just 'sig type t end'.
> To illustrate this, without showing the original code (which, as you  guessed it, has some extra and maybe unrelated
> complexity), i've tried  to reuse your example, by simply changing

You can still add the constraint to the SET type:

  module type SET = sig
    type t
    type elt
    module Elt : ELT with type t = elt
    val choose: t -> elt
    val singleton: elt -> t
    val string_of: t -> string
  end

You should also remove the equivalent constraint from the `Make`
functor:
   
  module Make (E : ELT) : SET with type elt = E.t = struct
    type elt = E.t
    type t = elt list
    module Elt = E
    let choose s = List.hd s
    let singleton e = [e]
    let string_of s = "{" ^ E.string_of (choose s) ^ "}"
  end

Regards,

Leo

      parent reply	other threads:[~2014-01-21 13:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-20 16:34 Jocelyn Sérot
2014-01-20 20:57 ` Leo White
2014-01-21 11:09   ` SEROT Jocelyn
2014-01-21 11:30     ` Josh Berdine
2014-01-21 14:30       ` SEROT Jocelyn
2014-01-21 13:32     ` Leo White [this message]

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=86lhy98nq0.fsf@cam.ac.uk \
    --to=lpw25@cam.ac.uk \
    --cc=Jocelyn.SEROT@univ-bpclermont.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).