# Functor implementing polymorphic module type... Help!

**URL:** <https://discuss.ocaml.org/t/functor-implementing-polymorphic-module-type-help/6382>\
**Category:** Learning\
**Tags:** types, functor, polymorphism\
**Created:** [September 8, 2020, 7:25pm UTC](https://discuss.ocaml.org/t/functor-implementing-polymorphic-module-type-help/6382 "2020-09-08T19:25:10Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![kantian](https://avatars.discourse-cdn.com/v4/letter/k/4bbf92/32.png) [@kantian](https://discuss.ocaml.org/u/kantian)\
**Post date:** [September 8, 2020, 7:53pm UTC](https://discuss.ocaml.org/t/functor-implementing-polymorphic-module-type-help/6382/3 "2020-09-08T19:53:34Z")

</div>

You can’t do exactly what you want (define a polymorphic set) but something close:

```auto
(*first your signature for set should be*)
module type Set = sig
  type t (*the type of the sets*)
  type elt (*the type of the elements*)

  val empty : t

  val mem : elt -> t -> bool

  val add : elt -> t -> t

  val elts : t -> elt list
end

```

and then use your implementation with this type annotation:

```ocaml
module ListSet (M : Equal) : Set with type elt = M.t = struct

 (* put your implementation as above*)

end

```

Maybe this [post](https://discuss.ocaml.org/t/help-me-to-understand-functors/2525/11) could help you to understand a little bit more.

---

_[View the full topic](https://discuss.ocaml.org/t/functor-implementing-polymorphic-module-type-help/6382)._
