makeRecordCodecFromDefinition = (label, labelType, definition) => {
  /**
   * @param {SyrupReader} syrupReader
   * @returns {any}
   */
  const readBody = syrupReader => {
    const result = {};
    for (const field of definition) {
      const [fieldName, fieldType] = field;
      const fieldCodec = resolveCodec(fieldType);
      result[fieldName] = fieldCodec.read(syrupReader);
    }
    result.type = label;
    return result;
  };
  /**
   * @param {any} value
   * @param {SyrupWriter} syrupWriter
   */
  const writeBody = (value, syrupWriter) => {
    for (const field of definition) {
      const [fieldName, fieldType] = field;
      const fieldValue = value[fieldName];
      const fieldCodec = resolveCodec(fieldType, fieldValue);
      fieldCodec.write(fieldValue, syrupWriter);
    }
  };

  return makeRecordCodec(label, labelType, readBody, writeBody);
}
@param {string} label
@param {SyrupRecordLabelType} labelType
@param {SyrupRecordDefinition} definition
@returns {SyrupRecordCodec}