decodeProgramJson function

Program decodeProgramJson(
  1. Object? json
)

Decodes a Program from a ball file, or throws if it wraps a Module.

Implementation

Program decodeProgramJson(Object? json) => switch (decodeBallFileJson(json)) {
  BallProgramFile(:final program) => program,
  BallModuleFile() => throw BallFileFormatException(
    'expected a Program ball file but got a Module',
  ),
};