Commits

camlspotter  committed 2d9e82d

open tweak

  • Participants
  • Parent commits 5f14c84

Comments (0)

Files changed (3)

-type unknown
-
 type ('phantom, 'content) t = 'content
 type ('phantom, 'content) ts = 'content list
 
-let (!<) x = x
-let (!>) x = x
-let (!?) x = x
+module Open = struct
+  type unknown
+  let unknown : unknown = Obj.magic 0
+  let (!<) x = x
+  let (!>) x = x
+  let (!?) x = x
+end
+include Open
 let unsafe x = x
 let unsafe_list x = x
 let magic x = x
-type unknown 
-
 type ('phantom, 'cont) t
 type ('phantom, 'cont) ts
 
+(* Rather than open Phantom, I recommend to open Phantom.Open *)
+module Open : sig
+  type unknown 
+  val unknown : unknown
+  val (!<) : ('a, 'cont) t -> 'cont
+  (** Forget the phantom *)
+  val (!>) : 'cont -> (unknown, 'cont) t
+  (** Safe lift up with the unknown phantom *)
+  val (!?) : ('a, 'cont) t -> (unknown, 'cont) t
+  (** Forget the phantom *)
+end
+type unknown = Open.unknown
+val unknown : Open.unknown
 val (!<) : ('a, 'cont) t -> 'cont
-(** Forget the phantom *)
 val (!>) : 'cont -> (unknown, 'cont) t
-(** Safe lift up with the unknown phantom *)
 val (!?) : ('a, 'cont) t -> (unknown, 'cont) t
-(** Forget the phantom *)
 
 val unsafe : 'cont -> ('unsafe, 'cont) t
 (** [unsafe v] lifts up [v] of [elt] to one with any phantom. Use with care. *)
   include Xformat
 end
 
-module Phantom_intf = Phantom_intf
+(* module Phantom_intf = Phantom_intf *)
 module Phantom = Phantom
-module Phantomx = Phantomx