Commits

camlspotter  committed fdf4f75

abandoned sexp and using ocaml...

  • Participants
  • Parent commits e7a867f
  • Branches dev

Comments (0)

Files changed (2)

 OCAMLPACKS[] =
     curl
     tiny_json_conv
+    ocaml_conv
     sexplib
     spotlib
 
 open Tiny_json
 open Json_conv
 open Sexplib.Conv
+open Ocaml_conv
 
 open Meta_conv.Types.Result.Open
 
-type 'target mc_fields = (string * 'target) list with sexp
-type 'target mc_leftovers = 'target mc_fields with sexp
+type 'target mc_leftovers = (string * 'target) list with conv(ocaml)
 
 module Json = struct
   include Json
-  let sexp_of_t j = Sexplib.Sexp.Atom (Json.show j)
-  let t_of_sexp = function
-    | Sexplib.Sexp.Atom s -> Json.parse s
+  let ocaml_of_t j = Ocaml.String (Json.show j)
+  let t_of_ocaml = function
+    | Ocaml.String s -> `Ok (Json.parse s)
     | _ -> assert false
 end
 
 module Scheme = struct
-  type t = Hg(:"hg":) | Git(:"git":) with conv(json), sexp
+  type t = Hg(:"hg":) | Git(:"git":) with conv(json), conv(ocaml)
 end
 
 module LocalTime = struct
-  type t = string with conv(json), sexp
+  type t = string with conv(json), conv(ocaml)
 end
 
 module UTCTime = struct
-  type t = string with conv(json), sexp
+  type t = string with conv(json), conv(ocaml)
 end
 
 module Error = struct
     
   (** Full repository information *)
   module Repository = struct
-    type t = {
+    type t = <
       name              : string;
       scm               : Scheme.t;
       has_wiki          : bool;
       fork_of           : t option;
       mq_of             : t option;
       creator           : string option;
-    } with conv(json), sexp
+    > with conv(json), conv(ocaml)
   end
 
   (** Commited file *)  
     type t = {
       type_ as "type" : string;
       file : string;
-    } with conv(json), sexp
+    } with conv(json), conv(ocaml)
   end
 
   (** Branch info *)    
       parents      : string list;
       branch       : string;
       unknown      : Json.t mc_leftovers;
-    } with conv(json), sexp
+    } with conv(json), conv(ocaml)
 
   end
 
       avatar       : string;
       resource_uri : string;
       user_rest    : Json.t mc_leftovers;
-    } with conv(json), sexp
+    } with conv(json), conv(ocaml)
   end
 
   module User = struct
     type t = {
       user : UserID.t;
       repositories : Repository.t list;
-      rest (: Leftovers :) : Json.t mc_fields;
-    } with conv(json), sexp
+      rest : Json.t mc_leftovers;
+    } with conv(json), conv(ocaml)
   end
 
   module UserRepo = struct
   (* https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/branches *)
   module Branches = struct
 
-    type t = Data.Branch.t mc_fields with conv(json), sexp
+    type t = Data.Branch.t mc_fields with conv(json), conv(ocaml)
 
     let get ~accountname ~repo_slug = 
       Format.eprintf "%s : %s...@." accountname repo_slug;