File size: 403 Bytes
6851d40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// RUN: %verify "%s"

module {:options "-functionSyntax:4"} JSON.Values {
  datatype Decimal =
    Decimal(n: int, e10: int) // (n) * 10^(e10)

  function Int(n: int): Decimal {
    Decimal(n, 0)
  }

  datatype JSON =
    | Null
    | Bool(b: bool)
    | String(str: string)
    | Number(num: Decimal)
    | Object(obj: seq<(string, JSON)>) // Not a map to preserve order
    | Array(arr: seq<JSON>)
}