caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Referencing a functor type
@ 2016-01-14 11:14 Nick Betteridge
  2016-01-14 11:24 ` Nicolas Ojeda Bar
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Betteridge @ 2016-01-14 11:14 UTC (permalink / raw)
  To: caml-list

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;
  }

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-01-18 16:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-14 11:14 [Caml-list] Referencing a functor type Nick Betteridge
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

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).