Commit d3e4523f authored by Pietro Abate's avatar Pietro Abate

[r2004-05-23 11:13:58 by afrisch] Simplify idents

Original author: afrisch
Date: 2004-05-23 11:13:58+00:00
parent c4d36a49
...@@ -136,3 +136,13 @@ struct ...@@ -136,3 +136,13 @@ struct
end end
module Weak(H : Custom.T) = struct
type value = H.t
module P = Weak.Make(H)
let pool = P.create 17
include H
let mk = P.merge pool
let value x = x
end
...@@ -22,3 +22,13 @@ end ...@@ -22,3 +22,13 @@ end
module Make(H : Custom.T) : T with type value = H.t and type t = int module Make(H : Custom.T) : T with type value = H.t and type t = int
module NoHash(H : Custom.T) : T with type value = H.t and type t = int module NoHash(H : Custom.T) : T with type value = H.t and type t = int
module Weak(H : Custom.T) : sig
include Custom.T
type value = H.t
val mk: value -> t
val value: t -> value
end
module U = Encodings.Utf8 module U = Encodings.Utf8
module IdPool = Weak.Make(U) module Id = Pool.Weak(U)
let id_pool = IdPool.create 17 type id = Id.t
module Id = struct
include U
let mk = IdPool.merge id_pool
let value x = x
end
type id = U.t
let ident = Id.mk let ident = Id.mk
let to_string id = U.to_string (Id.value id) let to_string id = U.to_string (Id.value id)
let print ppf id = Format.fprintf ppf "%s" (to_string id) let print ppf id = Format.fprintf ppf "%s" (to_string id)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment