UNPKG

@harmoniclabs/plu-ts-onchain

Version:

An embedded DSL for Cardano smart contracts creation coupled with a library for Cardano transactions, all in Typescript

30 lines (29 loc) 1.82 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._precursiveList = void 0; var type_system_1 = require("../../../../type_system/index.js"); var pfn_1 = require("../../../pfn.js"); var phoist_1 = require("../../../phoist.js"); var minimal_common_1 = require("../../data/conversion/minimal_common.js"); var minimal_1 = require("../pmatchList/minimal.js"); var minimal_2 = require("../../../precursive/minimal.js"); function _precursiveList(returnT, elemsT) { var finalType = (0, type_system_1.lam)((0, type_system_1.list)(elemsT), returnT); return (0, phoist_1.phoist)((0, minimal_2._precursive)((0, pfn_1.pfn)([ (0, type_system_1.fn)([ (0, type_system_1.lam)(finalType, (0, type_system_1.delayed)(returnT)), (0, type_system_1.fn)([finalType, elemsT, (0, type_system_1.list)(elemsT)], returnT), (0, type_system_1.list)(elemsT) ], returnT), (0, type_system_1.lam)(finalType, (0, type_system_1.delayed)(returnT)), (0, type_system_1.fn)([finalType, elemsT, (0, type_system_1.list)(elemsT)], returnT), (0, type_system_1.list)(elemsT) ], returnT)(function (self, matchNil, matchCons, lst) { var finalSelfTerm = (0, minimal_common_1._papp)((0, minimal_common_1._papp)(self, matchNil), matchCons); var exprTerm = (0, pfn_1.pfn)([finalSelfTerm.type], returnT)(function (finalSelf) { return (0, minimal_common_1._papp)((0, minimal_common_1._papp)((0, minimal_common_1._papp)((0, minimal_1._pmatchList)(returnT, elemsT), (0, minimal_common_1._papp)(matchNil, finalSelf)), (0, minimal_common_1._papp)(matchCons, finalSelf)), lst); }); return (0, minimal_common_1._papp)(exprTerm, finalSelfTerm); }, "_precursiveList"))); } exports._precursiveList = _precursiveList;