PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/graph/json.ml

http://github.com/hhughes/ocaml-frui
OCaml | 27 lines | 21 code | 6 blank | 0 comment | 2 complexity | bd4e422e6d651c461fa9ca8729977f48 MD5 | raw file
 1open Javascript
 2
 3class datum = object end
 4class item = object end
 5
 6module Datum =
 7struct
 8  external indicator : datum -> item = ".indicator"
 9  external country : datum -> item = ".country"
10  external value : datum -> string = ".value"
11  external date : datum -> string = ".date"
12end
13
14module Item =
15struct
16  external id : item -> string = ".id"
17  external value : item -> string = ".value"
18end
19
20external new_Object : string -> datum js_array js_array = "@eval"
21
22let unmarshall_json json = new_Object json
23
24let rec js_to_list msgs =
25  if msgs#_get_length > 0 then
26    msgs#pop :: (js_to_list msgs)
27  else []