type new_type_name
  [packed]
  [generic_level level]
  field type1 field_name1 field_name2 ...
  ...
  field type_n field_name_n ...

'packed' means that Pliant must not reorder the fields or insert holes between fields in order to improve alignment.
For 'generic_level' meaning, read the end of the document describing Pliant generic functions. (if not defined, the generic level is 1)

type new_type_name
  later

The new type content will be defined later. It is used when several types have pointers to each other in their fields. You must provide the real definition before using the new type in any function or as a true field (not a pointer)

Let's take an example:

type Complex
  field Float real
  field Float imaginary


function build x
  arg_w new_type_name x

Before calling this function, Pliant engine will initialize all the fields of the new instance. So this function is optional and will be used only when extra computations or initializations are required.

function destroy x
  arg_w new_type_name x

After calling this function, Pliant engine will clear all the fields of the new instance. So this function is optional and will be used only when extra computations or memory freeing is required.

function copy src dest
  arg new_type_name src ; arg_w new_type_name dest

If you don't define this function, all fields will be copied one after the other; if you define the function, you have to do everything manually.

function compare a b -> c
  arg new_type_name a b ; arg Int c

The function must return a constant taken from compare.pli
For some data types, you may return compare_different which means that the compared instances are different, but there is no order on that data type, so you cannot say which is the bigger one. As a result, using = or <> on that data type will be valid, but using other comparisons will generate an error. Booleans are such types.