From bd0befffb80c3086e3b451456cec24f3a12ac1f0 Mon Sep 17 00:00:00 2001 From: Enrico Tassi Date: Fri, 13 May 2016 17:44:45 +0200 Subject: Dyn: simplify API introducing an Easy submodule Now the casual Dyn user does not need to be a GADT guru --- library/libobject.ml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'library/libobject.ml') diff --git a/library/libobject.ml b/library/libobject.ml index bbbb134df..c566840e4 100644 --- a/library/libobject.ml +++ b/library/libobject.ml @@ -78,20 +78,9 @@ let object_tag (Dyn.Dyn (t, _)) = Dyn.repr t let cache_tab = (Hashtbl.create 17 : (string,dynamic_object_declaration) Hashtbl.t) -let make_dyn (type a) (tag : a Dyn.tag) = - let infun x = Dyn.Dyn (tag, x) in - let outfun : (Dyn.t -> a) = fun dyn -> - let Dyn.Dyn (t, x) = dyn in - match Dyn.eq t tag with - | None -> assert false - | Some Refl -> x - in - (infun, outfun) - let declare_object_full odecl = let na = odecl.object_name in - let tag = Dyn.create na in - let (infun, outfun) = make_dyn tag in + let (infun, outfun) = Dyn.Easy.make_dyn na in let cacher (oname,lobj) = odecl.cache_function (oname,outfun lobj) and loader i (oname,lobj) = odecl.load_function i (oname,outfun lobj) and opener i (oname,lobj) = odecl.open_function i (oname,outfun lobj) -- cgit v1.2.3