caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Nick Betteridge <lists.nick.betteridge@gmail.com>
To: caml-list@inria.fr
Subject: [Caml-list] Referencing a functor type
Date: Thu, 14 Jan 2016 11:14:04 +0000	[thread overview]
Message-ID: <569782FC.1020904@gmail.com> (raw)

Hi,

I'm trying to create a functor for different type of cipher which have
the same signature. The functor compiles Ok, but I can't work out how to
phrase my self_t to build up a list of local key types. Could anyone
suggest a way forward? Thanks, Nick.


module type Cipher = sig

  type local_t
  type remote_t

  val local_create : unit -> local_t
  val local_sign : local_t -> Cstruct.t -> Cstruct.t
  val remote_create : Cstruct.t -> remote_t
  val remote_validate : remote_t -> Cstruct.t -> bool

end

module Make_cipher :

  functor (Cipher_impl : Cipher) ->
    sig
      type local_t = Cipher_impl.local_t
      type remote_t = Cipher_impl.remote_t
      val local_create : unit -> local_t
      val local_sign : local_t -> Cstruct.t -> Cstruct.t
      val remote_create : Cstruct.t -> remote_t
      val remote_validate : remote_t -> Cstruct.t -> bool
    end

type self_t =
  {
    mutable modules : (module Cipher) list;
    mutable locals : Cipher_impl.local_t list;
  }

             reply	other threads:[~2016-01-14 11:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-14 11:14 Nick Betteridge [this message]
2016-01-14 11:24 ` Nicolas Ojeda Bar
2016-01-18  7:49   ` Nick Betteridge
2016-01-18 14:45     ` Runhang Li
2016-01-18 16:02       ` Nick Betteridge

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=569782FC.1020904@gmail.com \
    --to=lists.nick.betteridge@gmail.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;
as well as URLs for NNTP newsgroup(s).