1///|
2type Point FixedArray[UInt]
3
4///|
5pub impl 
trait Show {
  output(Self, &Logger) -> Unit
  to_string(Self) -> String
}
Show
for
type Point
Point
with
(self : Point, logger : &Logger) -> Unit
output
(
Point
self
:
type Point
Point
,
&Logger
logger
: &
trait Logger {
  write_string(Self, String) -> Unit
  write_substring(Self, String, Int, Int) -> Unit
  write_char(Self, Char) -> Unit
}

Trait for a logger, where debug logs can be written into

@builtin.Logger
) ->
Unit
Unit
{
6
&Logger
logger
.
(&Logger, String) -> Unit
write_string
("(")
7
&Logger
logger
.
(&Logger, String) -> Unit
write_string
(
Point
self
.
(self : Point) -> Int
row
().
(self : Int, radix~ : Int = ..) -> String
to_string
())
8
&Logger
logger
.
(&Logger, String) -> Unit
write_string
(", ")
9
&Logger
logger
.
(&Logger, String) -> Unit
write_string
(
Point
self
.
(self : Point) -> Int
column
().
(self : Int, radix~ : Int = ..) -> String
to_string
())
10
&Logger
logger
.
(&Logger, String) -> Unit
write_string
(")")
11} 12 13///| 14impl
trait ToJson {
  to_json(Self) -> Json
}
ToJson
for
type Point
Point
with
(self : Point) -> Json
to_json
(
Point
self
:
type Point
Point
) ->
enum Json {
  Null
  True
  False
  Number(Double)
  String(String)
  Array(Array[Json])
  Object(Map[String, Json])
}
Json
{
15 { "row":
Point
self
.
(self : Point) -> Int
row
().
(self : Int) -> Json
to_json
(), "column":
Point
self
.
(self : Point) -> Int
column
().
(self : Int) -> Json
to_json
() }
16} 17 18///| 19fn
(row : UInt, column : UInt) -> Point
ts_point_new
(
UInt
row
:
UInt
UInt
,
UInt
column
:
UInt
UInt
) ->
type Point
Point
{
20 [
UInt
row
,
UInt
column
]
21} 22 23///| 24pub fn
type Point
Point
::
(row : Int, column : Int) -> Point
new
(
Int
row
:
Int
Int
,
Int
column
:
Int
Int
) ->
type Point
Point
{
25
(row : UInt, column : UInt) -> Point
ts_point_new
(
(value : Int) -> UInt
int_to_uint
(
Int
row
),
(value : Int) -> UInt
int_to_uint
(
Int
column
))
26} 27 28///| 29fn
(self : Point) -> UInt
ts_point_row
(
Point
self
:
type Point
Point
) ->
UInt
UInt
{
30
Point
self
.
Unit
_
[0]
31} 32 33///| 34pub fn
type Point
Point
::
(self : Point) -> Int
row
(
Point
self
:
type Point
Point
) ->
Int
Int
{
35
(value : UInt) -> Int
uint_to_int
(
(self : Point) -> UInt
ts_point_row
(
Point
self
))
36} 37 38///| 39fn
(self : Point) -> UInt
ts_point_column
(
Point
self
:
type Point
Point
) ->
UInt
UInt
{
40
Point
self
.
Unit
_
[1]
41} 42 43///| 44pub fn
type Point
Point
::
(self : Point) -> Int
column
(
Point
self
:
type Point
Point
) ->
Int
Int
{
45
(value : UInt) -> Int
uint_to_int
(
(self : Point) -> UInt
ts_point_column
(
Point
self
))
46} 47