-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathJson_Decode.resi
42 lines (31 loc) · 1012 Bytes
/
Json_Decode.resi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
type t<'a>
type fieldDecoders = {
optional: 'a. (. string, t<'a>) => option<'a>,
required: 'a. (. string, t<'a>) => 'a,
}
exception DecodeError(string)
module Error: {
let expected: (string, Js.Json.t) => _
}
let custom: ((. Js.Json.t) => 'a) => t<'a>
let id: t<Js.Json.t>
let float: t<float>
let int: t<int>
let bool: t<bool>
let string: t<string>
let array: t<'a> => t<array<'a>>
let list: t<'a> => t<list<'a>>
let object: (fieldDecoders => 'a) => t<'a>
let option: t<'a> => t<option<'a>>
let date: t<Js.Date.t>
let pair: (t<'a>, t<'b>) => t<('a, 'b)>
let tuple2: (t<'a>, t<'b>) => t<('a, 'b)>
let tuple3: (t<'a>, t<'b>, t<'c>) => t<('a, 'b, 'c)>
let tuple4: (t<'a>, t<'b>, t<'c>, t<'d>) => t<('a, 'b, 'c, 'd)>
let dict: t<'a> => t<Js.Dict.t<'a>>
let field: (string, t<'a>) => t<'a>
let oneOf: array<t<'a>> => t<'a>
let map: (t<'a>, (. 'a) => 'b) => t<'b>
let flatMap: (t<'a>, (. 'a) => t<'b>) => t<'b>
let indirect: (() => t<'a>) => t<'a>
let decode: (Js.Json.t, t<'a>) => result<'a, string>