github.com/solo-io/cue@v0.4.7/doc/tutorial/basics/2_types/05_types.txt (about)

     1  cue eval types.cue
     2  cmp stdout expect-stdout-cue
     3  
     4  -- frontmatter.toml --
     5  title = "Type Hierarchy"
     6  
     7  -- text.md --
     8  CUE defines the following type hierarchy
     9  
    10  ```
    11    null  bool  string  bytes  number  struct  list
    12                               /   \
    13                             int  float
    14  ```
    15  In addition, CUE defines the values
    16  bottom, or error, (denoted `_|_`)
    17  that is an instance of all types and
    18  top, or any, (denoted `_`) of which all types are an instance.
    19  
    20  Note how we use the terms types and values interchangeably.
    21  CUE does not distinguish between types and values.
    22  The term "type" merely refers to the kind of a value,
    23  which may or may not be a concrete instance.
    24  
    25  In the example, `point` defines an arbitrary point, while `xaxis` and `yaxis`
    26  define the points on the respective lines.
    27  We say that `point`, `xaxis`, and `yaxis` are incomplete,
    28  as they do not specify a specific point.
    29  Incomplete values cannot be represented as JSON,
    30  as it can only represent concrete values.
    31  
    32  The only concrete point is `origin`.
    33  The `origin` is defined to be both on the x-axis and y-axis, which means it
    34  must be at `0, 0`.
    35  Here we see constraints in action:
    36  `origin` evalutes to `0, 0`, even though we did not specify its coordinates
    37  explicitly.
    38  
    39  -- types.cue --
    40  point: {
    41      x: number
    42      y: number
    43  }
    44  
    45  xaxis: point
    46  xaxis: y: 0
    47  
    48  yaxis: point
    49  yaxis: x: 0
    50  
    51  origin: xaxis & yaxis
    52  
    53  -- expect-stdout-cue --
    54  point: {
    55      x: number
    56      y: number
    57  }
    58  xaxis: {
    59      x: number
    60      y: 0
    61  }
    62  yaxis: {
    63      x: 0
    64      y: number
    65  }
    66  origin: {
    67      x: 0
    68      y: 0
    69  }