caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Converting "fun ... (type t) ..." into a caml < 3.12 code
@ 2011-01-26 12:58 Julien Signoles
  2011-01-26 15:17 ` Stefan Holdermans
  2011-01-26 16:55 ` Jeremy Yallop
  0 siblings, 2 replies; 5+ messages in thread
From: Julien Signoles @ 2011-01-26 12:58 UTC (permalink / raw)
  To: Caml List

[-- Attachment #1: Type: text/plain, Size: 508 bytes --]

Hello,

How to convert the following ocaml 3.12 code into a typable ocaml < 3.12
code?
I have a solution using Obj. Is it possible without Obj?

=====
(* val f: 'a -> 'a list *)
let f (type u) (x:u) =
  let module S =
    Set.Make(struct
      type t = u
      let compare = Pervasives.compare
      let equal = ( = )
    end)
  in
  S.elements (S.singleton x)
=====

The contraints are:
* do not change the type of f
* use the functor Set.Make where type of keys are the same that type of x

Thanks,
Julien

[-- Attachment #2: Type: text/html, Size: 600 bytes --]

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

end of thread, other threads:[~2011-01-27 14:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-26 12:58 [Caml-list] Converting "fun ... (type t) ..." into a caml < 3.12 code Julien Signoles
2011-01-26 15:17 ` Stefan Holdermans
     [not found]   ` <AANLkTinyQn4L0C8hHHXJP20upzi++2oKU6RC-2ZTEjDA@mail.gmail.com>
2011-01-26 16:30     ` Julien Signoles
2011-01-26 16:55 ` Jeremy Yallop
2011-01-27 14:18   ` Julien Signoles

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