@harmoniclabs/plu-ts-onchain
Version:
An embedded DSL for Cardano smart contracts creation coupled with a library for Cardano transactions, all in Typescript
34 lines (33 loc) • 1.53 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.pshow = void 0;
var type_system_1 = require("../../type_system/index.js");
var tyArgs_1 = require("../../type_system/tyArgs/index.js");
var bool_1 = require("./bool.js");
var bs_1 = require("./bs.js");
var data_1 = require("./data.js");
var int_1 = require("./int.js");
var pair_1 = require("./pair.js");
var list_1 = require("./list.js");
var str_1 = require("./str.js");
var unit_1 = require("./unit.js");
function pshow(t) {
if ((0, type_system_1.typeExtends)(t, type_system_1.int))
return int_1.pshowInt;
if ((0, type_system_1.typeExtends)(t, type_system_1.bs))
return bs_1.pshowBs;
if ((0, type_system_1.typeExtends)(t, type_system_1.str))
return str_1.pshowStr;
if ((0, type_system_1.typeExtends)(t, type_system_1.unit))
return unit_1.pshowUnit;
if ((0, type_system_1.typeExtends)(t, type_system_1.bool))
return bool_1.pshowBool;
if ((0, type_system_1.typeExtends)(t, type_system_1.data))
return data_1.pshowData;
if ((0, type_system_1.typeExtends)(t, (0, type_system_1.list)((0, type_system_1.tyVar)())))
return (0, list_1.pshowList)((0, tyArgs_1.getElemsT)(t));
if ((0, type_system_1.typeExtends)(t, (0, type_system_1.pair)((0, type_system_1.tyVar)(), (0, type_system_1.tyVar)())))
return (0, pair_1.pshowPair)(t);
throw new Error("missing standard show for type: " + (0, type_system_1.termTypeToString)(t));
}
exports.pshow = pshow;