UNPKG

@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.69 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.pstdEq = void 0; var type_system_1 = require("../../../type_system/index.js"); var tyArgs_1 = require("../../../type_system/tyArgs/index.js"); var bool_1 = require("../../builtins/bool/index.js"); var bs_1 = require("../../builtins/bs/index.js"); var data_1 = require("../../builtins/data/index.js"); var intBinOpToBool_1 = require("../../builtins/int/intBinOpToBool.js"); var str_1 = require("../../builtins/str/index.js"); var list_1 = require("../list/index.js"); var peqPair_1 = require("../pair/peqPair.js"); var peqUnit_1 = require("../unit/peqUnit.js"); function pstdEq(t) { if ((0, type_system_1.typeExtends)(t, type_system_1.int)) return intBinOpToBool_1.peqInt; if ((0, type_system_1.typeExtends)(t, type_system_1.bs)) return bs_1.peqBs; if ((0, type_system_1.typeExtends)(t, type_system_1.str)) return str_1.peqStr; if ((0, type_system_1.typeExtends)(t, type_system_1.unit)) return peqUnit_1.peqUnit; if ((0, type_system_1.typeExtends)(t, type_system_1.bool)) return bool_1.peqBool; if ((0, type_system_1.typeExtends)(t, type_system_1.data)) return data_1.peqData; if ((0, type_system_1.typeExtends)(t, (0, type_system_1.list)((0, type_system_1.tyVar)()))) return (0, list_1.peqList)((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, peqPair_1.peqPair)(t); throw new Error("missing standard equality for type: " + (0, type_system_1.termTypeToString)(t)); } exports.pstdEq = pstdEq;